Exploratory Data Analysis
Overdose Deaths
############################## EDA: Plot the Outcome and Intervention Trends ###############################
#plot the time series of the number of deaths and probability of overdose death
od_data_recent <- read.csv("./Data/od_unintentional_yearly_18_and_up_11_28_21.txt",
sep = "\t", stringsAsFactors = FALSE)
od_data_recent$Deaths <- as.numeric(od_data_recent$Deaths)
od_data_recent<-od_data_recent[!is.na(od_data_recent$Year),] #delete the rows that just contains data set description info
od_data_recent<- od_data_recent %>%
filter(Year > 1999 & Year < 2020) %>%
group_by(Year) %>%
summarise(sum_deaths = sum(Deaths, na.rm = TRUE))
# pdf("./Figures/total_od_deaths_all_paper_11_29_21_2000_2019.pdf")
ggplot(data = od_data_recent, mapping = aes(x = Year, y = sum_deaths)) +
geom_line() +
geom_point() +
labs(x = "Year", y = "Yearly Number of Unintentional Drug Overdose Deaths in the 50 U.S. States") +
theme(panel.background = element_rect("white"),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
axis.title=element_text(family="Times", size=10, face="bold"),
axis.text=element_text(family="Times",size=10)) +
scale_x_continuous(breaks = seq(2000, 2020, by = 2)) +
ylim(c(0, 62000))

# dev.off()
main_analysis_data_sum <- main_analysis_data %>%
group_by(year = year(Time_Period_Start)) %>%
summarise(total_deaths = sum(imputed_deaths),
sum_pop = sum(population)/2,
total_prop = sum(imputed_deaths)/(sum(population)/2),
total_prop_by_100000 = 100000*sum(imputed_deaths)/(sum(population)/2))
# %>%mutate(date = as.Date(as.yearmon(year)))
#compute the percentage difference between 2000 and 2019
death_2000 <- main_analysis_data_sum$total_deaths[main_analysis_data_sum$year == 2000]
death_2019 <- main_analysis_data_sum$total_deaths[main_analysis_data_sum$year == 2019]
((death_2019 - death_2000)/death_2000)*100
## [1] 435.5701
Intervention: DIH Prosecutions
#plot the number of states with an intervention for each time point
#first, create a data set to find the number of states with an intervention at each time point
#initialize the data set with the start date of the time period
num_states_with_intervention<-data.frame("Start_Date" =
unique((main_analysis_data$Intervention_First_Date[!is.na(main_analysis_data$Intervention_First_Date)])))
numStates<-c()
#for each time period i, we first find the states where the first intervention date occurred before i
#then, we append it to numStates
for(i in unique((num_states_with_intervention$Start_Date))){
states_w_int<-unique(main_analysis_data$State[(main_analysis_data$Intervention_First_Date)<=i])
numStates<-append(numStates, length(states_w_int[!is.na(states_w_int)]))
}
num_states_with_intervention$numStates<-numStates
num_states_with_intervention$Start_Date <- as.Date(num_states_with_intervention$Start_Date)
num_states_with_intervention <- rbind(data.frame("Start_Date" = c(as.Date("2000-01-01"),
as.Date("2019-12-31")),
"numStates" = c(0, max(num_states_with_intervention$numStates))),
num_states_with_intervention)
num_states_with_intervention <- num_states_with_intervention %>%
arrange(Start_Date) %>%
mutate(lag_numStates = lag(numStates))
num_states_with_intervention <- num_states_with_intervention %>%
pivot_longer( c("lag_numStates", "numStates"), "numStates")
# pdf("Figures/num_states_with_intervention_11_29_21.pdf")
ggplot(num_states_with_intervention, aes(x = Start_Date, y = value, group = 1)) +
geom_line() +
# geom_point(num_states_with_intervention[num_states_with_intervention$numStates == "numStates",],
# mapping = aes(x = Start_Date, y = value, group = 1), size = 1) +
labs(x = "Year", y = "Cumulative Number of States to have DIH Prosecutions") +
theme(axis.text=element_text(family="Times",size=10),
axis.title=element_text(family="Times", size=10, face="bold"),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
axis.text.x = element_text(family="Times", size=10),
panel.background = element_rect("white")) +
scale_x_date(date_labels="%Y", breaks = seq(as.Date("2000-01-01"), as.Date("2018-01-01"), by = "2 years"))

# dev.off()
Policy Dates
#add the intervention variable as a measure of number of states with DIH prosecution
main_analysis_data <- main_analysis_data %>%
group_by(Time_Period_Start) %>%
mutate(num_states_w_intervention = sum(Intervention_Redefined))
############################# Look at the policy dates #######################
policy_dates <- main_analysis_data %>%
group_by(State) %>%
summarise(unique(format(Intervention_First_Date, "%Y-%m")),
unique(format(as.Date(Naloxone_Pharmacy_Yes_First_Date), "%Y-%m")),
unique(format(as.Date(Naloxone_Pharmacy_No_First_Date), "%Y-%m")),
unique(format(as.Date(Medical_Marijuana_First_Date), "%Y-%m")),
unique(format(as.Date(Recreational_Marijuana_First_Date), "%Y-%m")),
unique(format(as.Date(PDMP_First_Date), "%Y-%m")),
unique(format(as.Date(GSL_First_Date), "%Y-%m")),
unique(format(as.Date(Medicaid_Expansion_First_Date), "%Y-%m")))
names(policy_dates) <- c("State", "DIH Prosecutions", "NAL: Pharmacists Yes",
"NAL: Pharmacists No", "MML", "RML", "PDMP", "GSL",
"Medicaid")
# write.csv(policy_dates, "./Data/policy_dates_11_29_21.csv")
Create Plot of Number of DIH Prosecutions Per State
#create a plot for each state to see how many prosecution media alerts there are per 6 month period
#read in the prosecution media alert data
prosecution_data<-read.csv("./Data/dih_prosecutions_9_6_21.csv")
#data cleaning
prosecution_data<-prosecution_data %>%
mutate(Date = as.Date(Date.charged, "%m/%d/%Y")) %>%
mutate(State = ifelse(State.Filed == "pennsylvania", "Pennsylvania", State.Filed),
State = ifelse(State.Filed == "Virginia ", "Virginia", State)) %>%
mutate(deceased_age = ifelse(!is.na(as.numeric(Deceased.s.Age)), as.numeric(Deceased.s.Age), 9999)) %>%
filter(!is.na(Date),
State.Filed != "No Info",
State.Filed != "No info",
State.Filed != "No Info ",
deceased_age >= 18,
State != "" ) %>%
mutate(deceased_age = ifelse(deceased_age == 9999, NA, deceased_age))
#clean up the data by looking at the link to the article
prosecution_data$Date[prosecution_data$Date == "2026-08-01"] <- as.Date("2016-02-15", "%Y-%m-%d")
#change the states into Character instead of factor
prosecution_data$State<-as.character(prosecution_data$State)
#see how many prosecution data points there are for each state
table(prosecution_data$State)
##
## Alabama Alaska Arizona Arkansas California
## 11 7 7 4 65
## Colorado Connecticut Delaware Florida Georgia
## 29 43 3 133 27
## Idaho Illinois Indiana Iowa Kansas
## 8 330 55 31 6
## Kentucky Louisiana Maine Maryland Massachusetts
## 41 63 17 58 33
## Michigan Minnesota Mississippi Missouri Montana
## 104 135 1 40 10
## Nebraska Nevada New Hampshire New Jersey New Mexico
## 1 11 38 134 4
## New York North Carolina North Dakota Ohio Oklahoma
## 96 121 51 379 39
## Oregon Pennsylvania Rhode Island South Carolina South Dakota
## 16 708 2 11 12
## Tennessee Texas Utah Vermont Virginia
## 94 43 17 12 59
## Washington West Virginia Wisconsin Wyoming
## 63 33 364 19
#there are some repeated cases depending on victim so extract distinct cases
prosecution_data_unique <- prosecution_data %>%
group_by(State) %>%
distinct(Accused.Name, Date, .keep_all = T)
table(prosecution_data_unique$State)
##
## Alabama Alaska Arizona Arkansas California
## 11 7 7 4 61
## Colorado Connecticut Delaware Florida Georgia
## 27 42 3 129 24
## Idaho Illinois Indiana Iowa Kansas
## 8 324 53 31 6
## Kentucky Louisiana Maine Maryland Massachusetts
## 41 63 17 57 33
## Michigan Minnesota Mississippi Missouri Montana
## 102 135 1 39 9
## Nebraska Nevada New Hampshire New Jersey New Mexico
## 1 11 38 129 4
## New York North Carolina North Dakota Ohio Oklahoma
## 91 118 38 372 32
## Oregon Pennsylvania Rhode Island South Carolina South Dakota
## 16 700 2 11 12
## Tennessee Texas Utah Vermont Virginia
## 94 42 17 12 59
## Washington West Virginia Wisconsin Wyoming
## 60 33 357 19
#change date charged into Date object
prosecution_data_unique$Date<-mdy(prosecution_data_unique$Date.charged)
#group the data into six month periods
prosecution_data_unique<-prosecution_data_unique %>%
mutate(six_month_pd = lubridate::floor_date(Date , "6 months" ))
prosecution_grouped <- prosecution_data_unique %>%
#filter to dates after 2000 and dates before 2020
filter(year(six_month_pd) >= 2000 & year(six_month_pd) <= 2019) %>%
group_by(State, six_month_pd) %>%
#for each state, for each six month period, count the number of DIH prosecutions
summarise(num_dih = n()) %>%
#ONLY IF GROUPS
#label the groups according to zero, low, or high
mutate(group = ifelse(num_dih == 0, "zero", ifelse(num_dih >= 5, "high", "low"))) %>%
ungroup() %>%
#have to add in a row for hawaii because its not in the prosecution dataset
add_row(State = "Hawaii", six_month_pd = as.Date("2000-01-01"), num_dih = 0, group = "zero")
#look at table of ages of the victims
table(as.numeric(prosecution_data_unique$Deceased.s.Age))
##
## 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
## 88 107 88 155 132 150 142 130 152 122 152 110 148 92 96 100 84 97 46 56
## 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
## 54 53 61 47 27 37 21 29 23 38 24 29 27 18 14 15 17 15 11 10
## 58 59 60 61 62 63 64 66 67 68 69 75 85 87
## 10 22 4 4 7 2 2 2 1 1 3 1 1 1
table(as.numeric(prosecution_data_unique$Deceased.s.Age))/sum(!is.na(as.numeric(prosecution_data_unique$Deceased.s.Age)))
##
## 18 19 20 21 22 23
## 0.0305767894 0.0371785962 0.0305767894 0.0538568450 0.0458651842 0.0521195274
## 24 25 26 27 28 29
## 0.0493398193 0.0451702571 0.0528144545 0.0423905490 0.0528144545 0.0382209868
## 30 31 32 33 34 35
## 0.0514246004 0.0319666435 0.0333564976 0.0347463516 0.0291869354 0.0337039611
## 36 37 38 39 40 41
## 0.0159833218 0.0194579569 0.0187630299 0.0184155664 0.0211952745 0.0163307853
## 42 43 44 45 46 47
## 0.0093815149 0.0128561501 0.0072967338 0.0100764420 0.0079916609 0.0132036136
## 48 49 50 51 52 53
## 0.0083391244 0.0100764420 0.0093815149 0.0062543433 0.0048644892 0.0052119527
## 54 55 56 57 58 59
## 0.0059068798 0.0052119527 0.0038220987 0.0034746352 0.0034746352 0.0076441974
## 60 61 62 63 64 66
## 0.0013898541 0.0013898541 0.0024322446 0.0006949270 0.0006949270 0.0006949270
## 67 68 69 75 85 87
## 0.0003474635 0.0003474635 0.0010423905 0.0003474635 0.0003474635 0.0003474635
#view table of people in each age category, based on prosecution data
prosecution_data_unique <- prosecution_data_unique %>%
mutate(Deceased.s.Age = as.numeric(Deceased.s.Age),
age_groups = ifelse(Deceased.s.Age <= 17, "0_17",
ifelse(Deceased.s.Age >= 18 & Deceased.s.Age <= 34, "18_34",
ifelse(Deceased.s.Age >= 35 & Deceased.s.Age <= 54, "35_54",
ifelse(Deceased.s.Age >= 55 & Deceased.s.Age <= 64, "55_64", "65_plus")))))
table(prosecution_data_unique$age_groups, exclude = "NA")
##
## 18_34 35_54 55_64 65_plus <NA>
## 2048 733 87 10 624
#we compute the final group for each state by seeing if it ever hits high or low
#if it hits a higher level, then it will remain defined in that higher level
prosecution_grouped_final <- prosecution_grouped %>%
group_by(State) %>%
summarise(final_gp = ifelse(sum(group == "high") > 0, "high", ifelse(sum(group == "low")> 0, "low", "zero")))
#plot of the number of states in each zero/low/high category
ggplot(prosecution_grouped_final, aes(final_gp)) +
geom_bar() +
labs(title = "Number of States by DIH prosecution Category, with Low = [1,5]") +
geom_text(aes(label = ..count..), stat = "count", vjust = -.75)

#number of DIH prosecutions per six month for each state
# pdf("Figures/num_dih_per_six_month_pd_by_state_11_29_21.pdf")
ggplot(prosecution_grouped, aes(x = six_month_pd, y = num_dih)) +
geom_bar(stat = "identity") +
facet_wrap(~State) +
labs(y = "Number of DIH Prosecutions Reported in the Media",
x = "Date") +
theme(axis.text.x = element_text(hjust = 1, size = 6, family = "Times", angle = 30),
axis.text.y = element_text(size = 6, family = "Times"),
axis.title = element_text(size = 10, face = "bold", family = "Times"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
strip.background = element_blank(),
strip.text = element_text(size=8),
panel.background = element_rect("white"),
legend.position = "bottom")

# dev.off()
# write.csv(prosecution_grouped, "./Data/num_dih_per_six_month_pd_by_state_11_12_21.csv")
Main Analysis: Effect of At Least One DIH Prosecution Report in Media on Unintentional Overdose Deaths
Analysis
############################## Run Model with Spline Time Effects by Region ###############################
#model that we will be using for the main analysis
#cr is used for cubic regression spline -- we are smoothing time effects by region
#run the analysis for all the states
main_analysis_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
Intervention_Redefined +
num_states_w_intervention,
data = main_analysis_data, family = "binomial")
#summary output of the model
stargazer(main_analysis_model, type = "html", dep.var.labels = c("Unintentional Overdose Deaths"))
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Deaths
|
|
|
|
StateAlaska
|
0.277***
|
|
|
(0.028)
|
|
|
|
|
StateArizona
|
0.315***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.390***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.159***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.096***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.189***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.430***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.253***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.071***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.226***
|
|
|
(0.026)
|
|
|
|
|
StateIdaho
|
-0.136***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.016
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.088***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.740***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.328***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.641***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.294***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.145***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.067***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.208***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.019
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.618***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.100***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.194***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.359***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.883***
|
|
|
(0.029)
|
|
|
|
|
StateNevada
|
0.439***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.257***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.107***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.631***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.238***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.177***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.053***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.455***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.385***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.194***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.436***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.238***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.221***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-0.960***
|
|
|
(0.043)
|
|
|
|
|
StateTennessee
|
0.436***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.204***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.072***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.167***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.112***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.078***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.876***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.037**
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.022
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.024***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.008
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.063***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.037***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.034***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.020***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.099***
|
|
|
(0.006)
|
|
|
|
|
Intervention_Redefined
|
0.062***
|
|
|
(0.005)
|
|
|
|
|
num_states_w_intervention
|
0.004**
|
|
|
(0.002)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.911***
|
|
|
(0.054)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.911
|
|
Log Likelihood
|
-16,751.790
|
|
UBRE
|
8.841
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#here, we estimate the variance-covariance matrix through the sandwich estimator
#we create a function so that we don't have to keep writing the code:
#cov_data is such that rows are state-time combinations and columns are the different policy measures
#coef_values need to be in order of the columns of cov_data
#z_value is the z-value that corresponds to the CI. We default to 95% CI so we default to 1.96
compute_sd_and_CI <- function(cov_data, population, observed_od, predicted_prob_od, coef_values, z_value = 1.96,
print_full_cov = FALSE){
#compute the predicted number of OD
pred_num_od <- population*predicted_prob_od
#compute the square of observed number of OD minus predicted number of OD
obs_minus_pred_num_od_sq <- (observed_od - pred_num_od)^2
#estimate the denominator term: sum_{s,t} n_{s,t}z_{s,t}*p_{s,t}*(1-p_{s,t})*z_{s,t}^T
#initialize the matrix so that we can add the terms to it
denominator <- matrix(0, nrow = ncol(cov_data), ncol = ncol(cov_data))
#estimate middle term: sum_{s,t} x_{s,t}*mean(prop_obs_od - prob_od)^2*x_{s,t}^T
middle_term <- matrix(0, nrow = ncol(cov_data), ncol = ncol(cov_data))
for(row in 1:nrow(cov_data)){
#note here: we first take t(cov_data[row]) since in the matrix, we have the state-time indices in the rows
#and the covariates in the columns
denominator <- denominator +
#don't need as.matrix() for the first term because transpose function t() automatically changes it to a matrix type
population[row]*t(cov_data[row,])%*%predicted_prob_od[row]%*%(1-predicted_prob_od[row])%*%as.matrix(cov_data[row,])
middle_term <- middle_term + t(cov_data[row,])%*%obs_minus_pred_num_od_sq[row]%*%as.matrix(cov_data[row,])
}
#variance-covariance = denominator^{-1}*middle_term*t(denominator^{-1})
#here, solve computes the inverse of the matrix
solve_denom <- solve(denominator)
var_cov <- solve_denom%*%middle_term%*%t(solve_denom)
#we obtain the standard deviations by taking the square root of the diagonal of the variance-covariance matrix.
sd_of_coefficients <- sqrt(diag(var_cov))
#find the CI for the coefficients
lb_coef <- coef_values - z_value*(sd_of_coefficients)
ub_coef <- coef_values + z_value*(sd_of_coefficients)
return_data_set <- data.frame(lb_coef, coef_values, ub_coef,
exp_lb = exp(lb_coef), exp_coef = exp(coef_values),
exp_ub = exp(ub_coef), sd_coef = sd_of_coefficients)
if(print_full_cov){
return(list(return_data_set = return_data_set, var_cov = var_cov))
}else{
return(return_data_set)
}
}
#compute the full dataset including basis functions
full_df_w_basis_functions <- data.frame(predict(main_analysis_model, type = "lpmatrix"))
#estimate the 95% CI and SD
coefficient_values <- coef(main_analysis_model)
#type = "response" to get the estimated probabilities
pred_prob <- predict(main_analysis_model, newdata = main_analysis_data, type = "response")
main_analysis_sd_and_ci <- compute_sd_and_CI(full_df_w_basis_functions, main_analysis_data$population, main_analysis_data$imputed_deaths,
pred_prob, coefficient_values)
main_analysis_sd_and_ci
## lb_coef coef_values
## (Intercept) -10.234472105 -9.910683905
## StateAlaska 0.176032938 0.277124435
## StateArizona 0.244219713 0.314585049
## StateArkansas -0.479716498 -0.390147951
## StateCalifornia -0.240336437 -0.159081744
## StateColorado 0.014170710 0.096391872
## StateConnecticut 0.107734285 0.189169793
## StateDelaware 0.299974509 0.429695792
## StateFlorida 0.178395912 0.252764060
## StateGeorgia -0.136052199 -0.070894080
## StateHawaii -0.328888120 -0.226207450
## StateIdaho -0.223099469 -0.136053870
## StateIllinois -0.101667742 -0.015719511
## StateIndiana 0.017820096 0.087870098
## StateIowa -0.824868290 -0.740259041
## StateKansas -0.424895551 -0.328118789
## StateKentucky 0.569540259 0.641036674
## StateLouisiana 0.222235770 0.293912126
## StateMaine 0.049266436 0.145218784
## StateMaryland -1.281508265 -1.066507716
## StateMassachusetts 0.104386263 0.207593170
## StateMichigan -0.090558648 -0.019359757
## StateMinnesota -0.699929262 -0.618346548
## StateMississippi -0.181257906 -0.099561652
## StateMissouri 0.118382614 0.193755948
## StateMontana -0.447749231 -0.359472606
## StateNebraska -0.981683800 -0.882834150
## StateNevada 0.354398364 0.438995770
## StateNew Hampshire 0.170321979 0.257357166
## StateNew Jersey 0.009366428 0.107244732
## StateNew Mexico 0.543628073 0.631025942
## StateNew York -0.311629282 -0.238478067
## StateNorth Carolina 0.111523873 0.176906773
## StateNorth Dakota -1.171429394 -1.052755943
## StateOhio 0.373621424 0.454809916
## StateOklahoma 0.283843748 0.385268538
## StateOregon -0.279156985 -0.194288428
## StatePennsylvania 0.366427227 0.435606947
## StateRhode Island 0.118635063 0.237999011
## StateSouth Carolina 0.155103335 0.221395567
## StateSouth Dakota -1.059825486 -0.959804373
## StateTennessee 0.370190919 0.436428815
## StateTexas -0.277719855 -0.203979570
## StateUtah -0.061945634 0.072187729
## StateVermont -0.261103728 -0.166606324
## StateVirginia -0.191400073 -0.112499188
## StateWashington -0.011885267 0.077566401
## StateWest Virginia 0.780982149 0.876250312
## StateWisconsin -0.101262359 -0.037268227
## StateWyoming -0.089149034 0.022121162
## Naloxone_Pharmacy_Yes_Redefined -0.075708023 -0.024109299
## Naloxone_Pharmacy_No_Redefined -0.029867750 0.008403335
## Medical_Marijuana_Redefined 0.018207068 0.062983026
## Recreational_Marijuana_Redefined -0.084589856 -0.036775616
## GSL_Redefined -0.009677639 0.033853246
## PDMP_Redefined -0.059692410 -0.019514080
## Medicaid_Expansion_Redefined 0.065377709 0.099106282
## Intervention_Redefined 0.026315489 0.061825922
## num_states_w_intervention -0.007330302 0.003692466
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.556475206 -0.326551741
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.274684958 -0.139695568
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.083022653 0.198272604
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.067525949 0.201175276
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.154737237 0.329753938
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.178592181 0.416895229
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.320366419 0.597772743
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.597030360 0.923763637
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.410166438 0.708188647
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.540690998 -0.301695230
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.396154448 -0.244672716
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.058917815 0.178776466
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.149866010 -0.019163734
## s(Time_Period_ID):as.factor(Region)Northeast.5 -0.072411988 0.103132451
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.009979158 0.249791985
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.250623885 0.528065600
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.584145713 0.926784801
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.421561235 0.718217718
## s(Time_Period_ID):as.factor(Region)South.1 -0.289796734 -0.118235559
## s(Time_Period_ID):as.factor(Region)South.2 -0.072063837 0.031863622
## s(Time_Period_ID):as.factor(Region)South.3 0.185045315 0.247525316
## s(Time_Period_ID):as.factor(Region)South.4 0.172362214 0.256400294
## s(Time_Period_ID):as.factor(Region)South.5 0.155926740 0.318308787
## s(Time_Period_ID):as.factor(Region)South.6 0.021213094 0.248053201
## s(Time_Period_ID):as.factor(Region)South.7 0.170954226 0.435139630
## s(Time_Period_ID):as.factor(Region)South.8 0.371830540 0.700598795
## s(Time_Period_ID):as.factor(Region)South.9 0.252408429 0.538449298
## s(Time_Period_ID):as.factor(Region)West.1 -0.345527864 -0.108779313
## s(Time_Period_ID):as.factor(Region)West.2 -0.066077130 0.071192079
## s(Time_Period_ID):as.factor(Region)West.3 0.052083876 0.170537711
## s(Time_Period_ID):as.factor(Region)West.4 0.113497738 0.235286628
## s(Time_Period_ID):as.factor(Region)West.5 0.002302678 0.183519387
## s(Time_Period_ID):as.factor(Region)West.6 -0.082809323 0.160989425
## s(Time_Period_ID):as.factor(Region)West.7 -0.074331781 0.203546159
## s(Time_Period_ID):as.factor(Region)West.8 -0.034876375 0.308306984
## s(Time_Period_ID):as.factor(Region)West.9 0.132703536 0.422321698
## ub_coef exp_lb
## (Intercept) -9.586895705 3.591081e-05
## StateAlaska 0.378215932 1.192477e+00
## StateArizona 0.384950385 1.276625e+00
## StateArkansas -0.300579405 6.189588e-01
## StateCalifornia -0.077827051 7.863633e-01
## StateColorado 0.178613035 1.014272e+00
## StateConnecticut 0.270605301 1.113752e+00
## StateDelaware 0.559417075 1.349824e+00
## StateFlorida 0.327132209 1.195298e+00
## StateGeorgia -0.005735961 8.727971e-01
## StateHawaii -0.123526780 7.197235e-01
## StateIdaho -0.049008271 8.000353e-01
## StateIllinois 0.070228721 9.033296e-01
## StateIndiana 0.157920100 1.017980e+00
## StateIowa -0.655649791 4.382927e-01
## StateKansas -0.231342027 6.538381e-01
## StateKentucky 0.712533088 1.767454e+00
## StateLouisiana 0.365588482 1.248866e+00
## StateMaine 0.241171132 1.050500e+00
## StateMaryland -0.851507167 2.776183e-01
## StateMassachusetts 0.310800077 1.110029e+00
## StateMichigan 0.051839135 9.134208e-01
## StateMinnesota -0.536763835 4.966204e-01
## StateMississippi -0.017865398 8.342202e-01
## StateMissouri 0.269129283 1.125675e+00
## StateMontana -0.271195982 6.390649e-01
## StateNebraska -0.783984499 3.746797e-01
## StateNevada 0.523593177 1.425323e+00
## StateNew Hampshire 0.344392353 1.185687e+00
## StateNew Jersey 0.205123037 1.009410e+00
## StateNew Mexico 0.718423812 1.722244e+00
## StateNew York -0.165326851 7.322529e-01
## StateNorth Carolina 0.242289672 1.117980e+00
## StateNorth Dakota -0.934082491 3.099236e-01
## StateOhio 0.535998409 1.452987e+00
## StateOklahoma 0.486693328 1.328225e+00
## StateOregon -0.109419871 7.564211e-01
## StatePennsylvania 0.504786668 1.442571e+00
## StateRhode Island 0.357362960 1.125959e+00
## StateSouth Carolina 0.287687799 1.167779e+00
## StateSouth Dakota -0.859783261 3.465163e-01
## StateTennessee 0.502666711 1.448011e+00
## StateTexas -0.130239286 7.575090e-01
## StateUtah 0.206321092 9.399340e-01
## StateVermont -0.072108921 7.702010e-01
## StateVirginia -0.033598303 8.258021e-01
## StateWashington 0.167018069 9.881851e-01
## StateWest Virginia 0.971518474 2.183616e+00
## StateWisconsin 0.026725904 9.036959e-01
## StateWyoming 0.133391357 9.147092e-01
## Naloxone_Pharmacy_Yes_Redefined 0.027489425 9.270869e-01
## Naloxone_Pharmacy_No_Redefined 0.046674421 9.705739e-01
## Medical_Marijuana_Redefined 0.107758984 1.018374e+00
## Recreational_Marijuana_Redefined 0.011038623 9.188891e-01
## GSL_Redefined 0.077384131 9.903690e-01
## PDMP_Redefined 0.020664251 9.420543e-01
## Medicaid_Expansion_Redefined 0.132834855 1.067562e+00
## Intervention_Redefined 0.097336354 1.026665e+00
## num_states_w_intervention 0.014715234 9.926965e-01
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.096628275 5.732260e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.004706178 7.598115e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.313522555 1.086566e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.334824603 1.069858e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.504770639 1.167351e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.655198276 1.195533e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.875179068 1.377632e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.250496914 1.816716e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.006210855 1.507069e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.062699461 5.823457e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.093190984 6.729028e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.298635116 1.060688e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.111538542 8.608233e-01
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.278676889 9.301476e-01
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.489604813 1.010029e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.805507315 1.284827e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.269423888 1.793458e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.014874200 1.524340e+00
## s(Time_Period_ID):as.factor(Region)South.1 0.053325616 7.484157e-01
## s(Time_Period_ID):as.factor(Region)South.2 0.135791080 9.304715e-01
## s(Time_Period_ID):as.factor(Region)South.3 0.310005318 1.203273e+00
## s(Time_Period_ID):as.factor(Region)South.4 0.340438373 1.188108e+00
## s(Time_Period_ID):as.factor(Region)South.5 0.480690835 1.168741e+00
## s(Time_Period_ID):as.factor(Region)South.6 0.474893308 1.021440e+00
## s(Time_Period_ID):as.factor(Region)South.7 0.699325033 1.186436e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.029367050 1.450387e+00
## s(Time_Period_ID):as.factor(Region)South.9 0.824490166 1.287122e+00
## s(Time_Period_ID):as.factor(Region)West.1 0.127969239 7.078466e-01
## s(Time_Period_ID):as.factor(Region)West.2 0.208461288 9.360587e-01
## s(Time_Period_ID):as.factor(Region)West.3 0.288991547 1.053464e+00
## s(Time_Period_ID):as.factor(Region)West.4 0.357075518 1.120189e+00
## s(Time_Period_ID):as.factor(Region)West.5 0.364736095 1.002305e+00
## s(Time_Period_ID):as.factor(Region)West.6 0.404788172 9.205267e-01
## s(Time_Period_ID):as.factor(Region)West.7 0.481424098 9.283636e-01
## s(Time_Period_ID):as.factor(Region)West.8 0.651490343 9.657248e-01
## s(Time_Period_ID):as.factor(Region)West.9 0.711939860 1.141911e+00
## exp_coef exp_ub
## (Intercept) 4.964147e-05 6.862211e-05
## StateAlaska 1.319331e+00 1.459678e+00
## StateArizona 1.369691e+00 1.469541e+00
## StateArkansas 6.769567e-01 7.403891e-01
## StateCalifornia 8.529266e-01 9.251244e-01
## StateColorado 1.101191e+00 1.195558e+00
## StateConnecticut 1.208246e+00 1.310758e+00
## StateDelaware 1.536790e+00 1.749652e+00
## StateFlorida 1.287579e+00 1.386985e+00
## StateGeorgia 9.315606e-01 9.942805e-01
## StateHawaii 7.975526e-01 8.837980e-01
## StateIdaho 8.727956e-01 9.521733e-01
## StateIllinois 9.844034e-01 1.072754e+00
## StateIndiana 1.091846e+00 1.171073e+00
## StateIowa 4.769903e-01 5.191046e-01
## StateKansas 7.202775e-01 7.934680e-01
## StateKentucky 1.898448e+00 2.039150e+00
## StateLouisiana 1.341666e+00 1.441362e+00
## StateMaine 1.156293e+00 1.272739e+00
## StateMaryland 3.442085e-01 4.267712e-01
## StateMassachusetts 1.230712e+00 1.364516e+00
## StateMichigan 9.808264e-01 1.053206e+00
## StateMinnesota 5.388346e-01 5.846372e-01
## StateMississippi 9.052341e-01 9.822932e-01
## StateMissouri 1.213800e+00 1.308824e+00
## StateMontana 6.980444e-01 7.624671e-01
## StateNebraska 4.136090e-01 4.565831e-01
## StateNevada 1.551149e+00 1.688082e+00
## StateNew Hampshire 1.293507e+00 1.411132e+00
## StateNew Jersey 1.113207e+00 1.227676e+00
## StateNew Mexico 1.879538e+00 2.051198e+00
## StateNew York 7.878260e-01 8.476166e-01
## StateNorth Carolina 1.193520e+00 1.274163e+00
## StateNorth Dakota 3.489747e-01 3.929462e-01
## StateOhio 1.575874e+00 1.709154e+00
## StateOklahoma 1.470009e+00 1.626928e+00
## StateOregon 8.234204e-01 8.963540e-01
## StatePennsylvania 1.545901e+00 1.656632e+00
## StateRhode Island 1.268708e+00 1.429555e+00
## StateSouth Carolina 1.247817e+00 1.333341e+00
## StateSouth Dakota 3.829678e-01 4.232538e-01
## StateTennessee 1.547172e+00 1.653124e+00
## StateTexas 8.154790e-01 8.778853e-01
## StateUtah 1.074857e+00 1.229148e+00
## StateVermont 8.465328e-01 9.304295e-01
## StateVirginia 8.935981e-01 9.669599e-01
## StateWashington 1.080654e+00 1.181776e+00
## StateWest Virginia 2.401877e+00 2.641953e+00
## StateWisconsin 9.634177e-01 1.027086e+00
## StateWyoming 1.022368e+00 1.142697e+00
## Naloxone_Pharmacy_Yes_Redefined 9.761790e-01 1.027871e+00
## Naloxone_Pharmacy_No_Redefined 1.008439e+00 1.047781e+00
## Medical_Marijuana_Redefined 1.065009e+00 1.113779e+00
## Recreational_Marijuana_Redefined 9.638924e-01 1.011100e+00
## GSL_Redefined 1.034433e+00 1.080457e+00
## PDMP_Redefined 9.806751e-01 1.020879e+00
## Medicaid_Expansion_Redefined 1.104184e+00 1.142061e+00
## Intervention_Redefined 1.063777e+00 1.102231e+00
## num_states_w_intervention 1.003699e+00 1.014824e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 7.214070e-01 9.078934e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 8.696229e-01 9.953049e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.219295e+00 1.368236e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.222839e+00 1.397695e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.390626e+00 1.656606e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.517244e+00 1.925524e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.818065e+00 2.399305e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.518752e+00 3.492078e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.030310e+00 2.735217e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 7.395634e-01 9.392257e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 7.829607e-01 9.110195e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.195753e+00 1.348018e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 9.810187e-01 1.117997e+00
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.108638e+00 1.321380e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.283758e+00 1.631671e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.695649e+00 2.237831e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 2.526373e+00 3.558802e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.050775e+00 2.759016e+00
## s(Time_Period_ID):as.factor(Region)South.1 8.884867e-01 1.054773e+00
## s(Time_Period_ID):as.factor(Region)South.2 1.032377e+00 1.145443e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.280852e+00 1.363432e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.292270e+00 1.405564e+00
## s(Time_Period_ID):as.factor(Region)South.5 1.374801e+00 1.617191e+00
## s(Time_Period_ID):as.factor(Region)South.6 1.281528e+00 1.607843e+00
## s(Time_Period_ID):as.factor(Region)South.7 1.545179e+00 2.012394e+00
## s(Time_Period_ID):as.factor(Region)South.8 2.014959e+00 2.799293e+00
## s(Time_Period_ID):as.factor(Region)South.9 1.713348e+00 2.280718e+00
## s(Time_Period_ID):as.factor(Region)West.1 8.969283e-01 1.136518e+00
## s(Time_Period_ID):as.factor(Region)West.2 1.073787e+00 1.231781e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.185942e+00 1.335080e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.265271e+00 1.429144e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.201438e+00 1.440134e+00
## s(Time_Period_ID):as.factor(Region)West.6 1.174673e+00 1.498985e+00
## s(Time_Period_ID):as.factor(Region)West.7 1.225742e+00 1.618377e+00
## s(Time_Period_ID):as.factor(Region)West.8 1.361119e+00 1.918398e+00
## s(Time_Period_ID):as.factor(Region)West.9 1.525499e+00 2.037941e+00
## sd_coef
## (Intercept) 0.165198061
## StateAlaska 0.051577294
## StateArizona 0.035900682
## StateArkansas 0.045698238
## StateCalifornia 0.041456476
## StateColorado 0.041949573
## StateConnecticut 0.041548728
## StateDelaware 0.066184328
## StateFlorida 0.037942933
## StateGeorgia 0.033243938
## StateHawaii 0.052388097
## StateIdaho 0.044411020
## StateIllinois 0.043851139
## StateIndiana 0.035739797
## StateIowa 0.043167984
## StateKansas 0.049375899
## StateKentucky 0.036477762
## StateLouisiana 0.036569569
## StateMaine 0.048955280
## StateMaryland 0.109694158
## StateMassachusetts 0.052656585
## StateMichigan 0.036325965
## StateMinnesota 0.041623833
## StateMississippi 0.041681762
## StateMissouri 0.038455783
## StateMontana 0.045039094
## StateNebraska 0.050433495
## StateNevada 0.043161942
## StateNew Hampshire 0.044405708
## StateNew Jersey 0.049937911
## StateNew Mexico 0.044590750
## StateNew York 0.037322049
## StateNorth Carolina 0.033358622
## StateNorth Dakota 0.060547679
## StateOhio 0.041422700
## StateOklahoma 0.051747342
## StateOregon 0.043300284
## StatePennsylvania 0.035295776
## StateRhode Island 0.060899974
## StateSouth Carolina 0.033822568
## StateSouth Dakota 0.051031180
## StateTennessee 0.033794845
## StateTexas 0.037622594
## StateUtah 0.068435389
## StateVermont 0.048212961
## StateVirginia 0.040255554
## StateWashington 0.045638606
## StateWest Virginia 0.048606205
## StateWisconsin 0.032650067
## StateWyoming 0.056770508
## Naloxone_Pharmacy_Yes_Redefined 0.026325880
## Naloxone_Pharmacy_No_Redefined 0.019526064
## Medical_Marijuana_Redefined 0.022844876
## Recreational_Marijuana_Redefined 0.024395020
## GSL_Redefined 0.022209635
## PDMP_Redefined 0.020499148
## Medicaid_Expansion_Redefined 0.017208456
## Intervention_Redefined 0.018117567
## num_states_w_intervention 0.005623861
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.117307891
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.068872138
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.058800995
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.068188432
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.089294235
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.121583188
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.141533839
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.166700652
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.152052147
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.121936617
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.077286598
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.061152373
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.066684835
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.089563489
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.122353483
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.141551896
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.174815861
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.151355348
## s(Time_Period_ID):as.factor(Region)South.1 0.087531212
## s(Time_Period_ID):as.factor(Region)South.2 0.053024214
## s(Time_Period_ID):as.factor(Region)South.3 0.031877552
## s(Time_Period_ID):as.factor(Region)South.4 0.042876571
## s(Time_Period_ID):as.factor(Region)South.5 0.082847983
## s(Time_Period_ID):as.factor(Region)South.6 0.115734748
## s(Time_Period_ID):as.factor(Region)South.7 0.134788471
## s(Time_Period_ID):as.factor(Region)South.8 0.167738906
## s(Time_Period_ID):as.factor(Region)South.9 0.145939219
## s(Time_Period_ID):as.factor(Region)West.1 0.120790077
## s(Time_Period_ID):as.factor(Region)West.2 0.070035311
## s(Time_Period_ID):as.factor(Region)West.3 0.060435630
## s(Time_Period_ID):as.factor(Region)West.4 0.062137189
## s(Time_Period_ID):as.factor(Region)West.5 0.092457504
## s(Time_Period_ID):as.factor(Region)West.6 0.124387116
## s(Time_Period_ID):as.factor(Region)West.7 0.141774459
## s(Time_Period_ID):as.factor(Region)West.8 0.175093550
## s(Time_Period_ID):as.factor(Region)West.9 0.147764368
Plots
#check diagnostics
gam.check(main_analysis_model)

##
## Method: UBRE Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [5.064278e-08,2.529474e-05]
## (score 8.840989 & scale 1).
## Hessian positive definite, eigenvalue range [8.477283e-05,0.0004428833].
## Model rank = 95 / 95
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(Time_Period_ID):as.factor(Region)Midwest 9.00 8.89 1.05 0.99
## s(Time_Period_ID):as.factor(Region)Northeast 9.00 8.96 1.05 0.99
## s(Time_Period_ID):as.factor(Region)South 9.00 8.93 1.05 1.00
## s(Time_Period_ID):as.factor(Region)West 9.00 8.22 1.05 0.98
main_analysis_model_object <- getViz(main_analysis_model)
midwest_plot <- plot(sm(main_analysis_model_object, 1)) +
l_fitLine() +
l_ciLine(mul = 5, linetype = 2) +
theme_classic() +
labs(x = "Time Period", y = "Smoothed Time Effects for Midwest") +
scale_x_continuous(breaks=c(1,11,21,31),
labels=c("2000", "2005", "2010", "2015")) +
theme(text=element_text(family="Times",size=10),
title = element_text(family="Times", size=10, face = "bold"),
panel.background = element_rect("white")) +
ylim(c(-1,1.2))
northeast_plot <- plot(sm(main_analysis_model_object,2)) +
l_fitLine() +
l_ciLine(mul = 5, linetype = 2) +
theme_classic() +
labs(x = "Time Period", y = "Smoothed Time Effects for Northeast") +
scale_x_continuous(breaks=c(1,11,21,31),
labels=c("2000", "2005", "2010", "2015"))+
theme(text=element_text(family="Times",size=10),
title = element_text(family="Times", size=10, face = "bold"),
panel.background = element_rect("white")) +
ylim(c(-1,1.2))
south_plot <- plot(sm(main_analysis_model_object, 3)) +
l_fitLine() +
l_ciLine(mul = 5, linetype = 2) +
theme_classic() +
labs(x = "Time Period", y = "Smoothed Time Effects for South") +
scale_x_continuous(breaks=c(1,11,21,31),
labels=c("2000", "2005","2010", "2015"))+
theme(text=element_text(family="Times",size=10),
title = element_text(family="Times", size=10, face = "bold"),
panel.background = element_rect("white")) +
ylim(c(-1,1.2))
west_plot <- plot(sm(main_analysis_model_object, 4)) +
l_fitLine() +
l_ciLine(mul = 5, linetype = 2) + theme_classic() +
labs(x = "Time Period", y = "Smoothed Time Effects for West") +
scale_x_continuous(breaks=c(1,11,21,31),
labels=c("2000", "2005", "2010", "2015"))+
theme(text=element_text(family="Times",size=10),
title = element_text(family="Times", size=10, face = "bold"),
panel.background = element_rect("white")) +
ylim(c(-1,1.2))
# pdf("./Figures/time_smoothed_effects_9_6_21.pdf")
gridPrint(midwest_plot, northeast_plot, south_plot, west_plot, ncol = 2)

# dev.off()
total_pop <- main_analysis_data %>%
group_by(year = year(Time_Period_Start), State) %>%
summarise(pop = unique(population)) %>%
group_by(year) %>%
summarise(sum(pop))
main_analysis_data %>%
group_by(year(Time_Period_Start)) %>%
summarise(sum_deaths = sum(imputed_deaths)*100000) %>%
mutate(sum_deaths/total_pop$`sum(pop)`)
## # A tibble: 20 x 3
## `year(Time_Period_Start)` sum_deaths `sum_deaths/total_pop$\`sum(pop)\``
## * <dbl> <dbl> <dbl>
## 1 2000 1151390000 5.52
## 2 2001 1276465000 6.03
## 3 2002 1614890000 7.54
## 4 2003 1799140000. 8.31
## 5 2004 1953250000 8.92
## 6 2005 2216225000 10.0
## 7 2006 2603525000 11.6
## 8 2007 2730800000 12.0
## 9 2008 2787500000 12.1
## 10 2009 2848100000 12.3
## 11 2010 2969200000 12.7
## 12 2011 3276800000 13.9
## 13 2012 3291600000 13.8
## 14 2013 3541000000 14.7
## 15 2014 3847600000 15.8
## 16 2015 4381900000 17.9
## 17 2016 5433100000 21.9
## 18 2017 6084700000 24.4
## 19 2018 5847900000 23.2
## 20 2019 6166500000 24.3
main_analysis_data %>%
group_by(State, year(Time_Period_Start)) %>%
summarise(death_rate = (sum(imputed_deaths)/unique(population))*100000) %>%
group_by(State) %>%
summarise(first_death_rate = death_rate[1],
last_death_rate = death_rate[20]) %>%
mutate(range_death_rate = last_death_rate - first_death_rate) %>%
filter(range_death_rate == min(range_death_rate) | range_death_rate == max(range_death_rate))
## # A tibble: 2 x 4
## State first_death_rate last_death_rate range_death_rate
## <chr> <dbl> <dbl> <dbl>
## 1 Nebraska 1.67 8.40 6.74
## 2 West Virginia 3.98 57.6 53.6
# #summarize the DIH dates
# main_analysis_data %>%
# group_by(Time_Period_Start) %>%
# summarise(prop_w_intervention = mean(Intervention_Redefined > 0)) %>%
# View()
#create a data frame to store the results and compute the confidence intervals
#initialize the columns
main_analysis_plot_table<-data.frame(State = main_analysis_data$State)
main_analysis_plot_table$Fitted<-rep(NA, nrow(main_analysis_plot_table))
main_analysis_plot_table$Observed<-rep(NA, nrow(main_analysis_plot_table))
main_analysis_plot_table$Time<-main_analysis_data$Time_Period_ID
main_analysis_plot_table$Time_Date<-main_analysis_data$Time_Period_Start
main_analysis_plot_table$Intervention_Date<-main_analysis_data$Intervention_First_Date
#we want to compare the fitted probability of overdose death and the observed values to see how the model does as a goodness of fit visual test
for(i in unique(main_analysis_plot_table$State)){
#for each state, we first subset the main analysis data to only look at the data for that state
index_of_state<-which(main_analysis_plot_table$State == i)
#impute the fitted and observed probability of overdose death for the state
main_analysis_plot_table$Fitted[index_of_state]<-fitted(main_analysis_model)[index_of_state]
main_analysis_plot_table$Observed[index_of_state] <- (main_analysis_data$imputed_deaths[main_analysis_data$State == i]/main_analysis_data$population[main_analysis_data$State == i])
}
#plot to compare the fitted values vs observed deaths
# pdf("./Figures/GAM_fitted_vs_actual_by_Region_1_18_22_with_int_date_full_data.pdf")
ggplot(data = main_analysis_plot_table, aes(x = Time_Date, y = Observed*100000, group = 1,
color = "Observed")) +
geom_line(aes(color = "Observed"))+ geom_point(aes(color = "Observed"), size = .5, alpha = .5) +
geom_line(data = main_analysis_plot_table, aes(x = Time_Date, y = Fitted*100000, group = 1,
color = "Estimate")) +
geom_point(data = main_analysis_plot_table, aes(x = Time_Date, y = Fitted*100000,
color = "Estimate"),
size = .5, alpha = .5) +
scale_color_manual(values = c("pink", "blue")) +
geom_vline(main_analysis_plot_table, mapping = aes(xintercept = Intervention_Date)) +
facet_wrap(facets = vars(State), scales = "free_y", ncol = 5) +
theme(axis.text.x = element_text(hjust = 1, size = 6, family = "Times"),
axis.text.y = element_text(size = 6, family = "Times"),
axis.title=element_text(size = 10,face = "bold", family = "Times"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
strip.background = element_blank(),
strip.text = element_text(size=8),
panel.background = element_rect("white"),
legend.position = "bottom") +
labs(x = "Year", y = "Unintentional Drug Overdose Death Rates per 100,000 People",
color = "")

# dev.off()
#diagnostic plots to check model
residTab <- data.frame(logit_fitted_vals = logit(fitted(main_analysis_model)),
resids = residuals(main_analysis_model))
# pdf("./Figures/deviance_resids_1_18_22.pdf")
ggplot(residTab, aes(x = logit_fitted_vals, y = resids)) +
geom_point() +
theme(text = element_text(size = 10, family = "Times"),
title = element_text(size = 10, family = "Times", face = "bold"),
panel.background = element_rect(fill = "white", color = "black")) +
# theme_classic() +
labs(x = "Logistic Function of Fitted Values", y = "Deviance Residuals")

# dev.off()
pred_vals <- predict(main_analysis_model)
resids <- resid(main_analysis_model, type = "response")
# pdf("./Figures/binned_resids_plot_9_6_21.pdf")
par(font.lab = 2)
par(family = "Times")
binnedplot(pred_vals, resids, main = "",
xlab = "Average Logistic Function of Fitted Values",
ylab = "Average Residuals")

# dev.off()
Compile Results
############################## Main Analysis: Make Data Frame of Results and 95% CI ###############################
#store the coefficients into the table
main_analysis_full_table<-main_analysis_sd_and_ci
#check to see how the table looks
head(main_analysis_full_table)
## lb_coef coef_values ub_coef exp_lb exp_coef
## (Intercept) -10.23447210 -9.91068390 -9.58689570 3.591081e-05 4.964147e-05
## StateAlaska 0.17603294 0.27712443 0.37821593 1.192477e+00 1.319331e+00
## StateArizona 0.24421971 0.31458505 0.38495039 1.276625e+00 1.369691e+00
## StateArkansas -0.47971650 -0.39014795 -0.30057941 6.189588e-01 6.769567e-01
## StateCalifornia -0.24033644 -0.15908174 -0.07782705 7.863633e-01 8.529266e-01
## StateColorado 0.01417071 0.09639187 0.17861303 1.014272e+00 1.101191e+00
## exp_ub sd_coef
## (Intercept) 6.862211e-05 0.16519806
## StateAlaska 1.459678e+00 0.05157729
## StateArizona 1.469541e+00 0.03590068
## StateArkansas 7.403891e-01 0.04569824
## StateCalifornia 9.251244e-01 0.04145648
## StateColorado 1.195558e+00 0.04194957
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"Intervention_Redefined",
"num_states_w_intervention")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(main_analysis_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(main_analysis_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(main_analysis_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(main_analysis_full_table)[i]<-substr(rownames(main_analysis_full_table)[i], start = 6,
stop = nchar(rownames(main_analysis_full_table)[i]))
}else if(rownames(main_analysis_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(main_analysis_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(main_analysis_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(main_analysis_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(main_analysis_full_table)[i], start = 36,
stop = nchar(rownames(main_analysis_full_table)[i])),
sep = "")
}
}
}
head(main_analysis_full_table)
## lb_coef coef_values ub_coef exp_lb
## Intercept/Alabama -10.23447210 -9.91068390 -9.58689570 3.591081e-05
## Alaska 0.17603294 0.27712443 0.37821593 1.192477e+00
## Arizona 0.24421971 0.31458505 0.38495039 1.276625e+00
## Arkansas -0.47971650 -0.39014795 -0.30057941 6.189588e-01
## California -0.24033644 -0.15908174 -0.07782705 7.863633e-01
## Colorado 0.01417071 0.09639187 0.17861303 1.014272e+00
## exp_coef exp_ub sd_coef
## Intercept/Alabama 4.964147e-05 6.862211e-05 0.16519806
## Alaska 1.319331e+00 1.459678e+00 0.05157729
## Arizona 1.369691e+00 1.469541e+00 0.03590068
## Arkansas 6.769567e-01 7.403891e-01 0.04569824
## California 8.529266e-01 9.251244e-01 0.04145648
## Colorado 1.101191e+00 1.195558e+00 0.04194957
tail(main_analysis_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.113497738 0.2352866 0.3570755 1.1201894
## Smoothed Time for Region West.5 0.002302678 0.1835194 0.3647361 1.0023053
## Smoothed Time for Region West.6 -0.082809323 0.1609894 0.4047882 0.9205267
## Smoothed Time for Region West.7 -0.074331781 0.2035462 0.4814241 0.9283636
## Smoothed Time for Region West.8 -0.034876375 0.3083070 0.6514903 0.9657248
## Smoothed Time for Region West.9 0.132703536 0.4223217 0.7119399 1.1419114
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.265271 1.429144 0.06213719
## Smoothed Time for Region West.5 1.201438 1.440134 0.09245750
## Smoothed Time for Region West.6 1.174673 1.498985 0.12438712
## Smoothed Time for Region West.7 1.225742 1.618377 0.14177446
## Smoothed Time for Region West.8 1.361119 1.918398 0.17509355
## Smoothed Time for Region West.9 1.525499 2.037941 0.14776437
#save the table into a CSV
# write.csv(round(main_analysis_full_table,5), "./Data/coefficients_GAM_1_18_22_full_data_uninentional_od.csv")
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(main_analysis_full_table) %in% covariates)
main_analysis_covariate_table<-(round(main_analysis_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(main_analysis_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Intervention",
"Number of States with DIH Prosecutions")
#now, reorganize the data so that the covariates are on top and the rest of the variable sare below
main_analysis_covariate_table<-rbind(main_analysis_covariate_table,
main_analysis_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
main_analysis_covariate_table<-main_analysis_covariate_table[,-which(colnames(main_analysis_covariate_table) %in%
c("lb_coef", "coef_values",
"ub_coef"))]
colnames(main_analysis_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(main_analysis_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates
## Naloxone_Pharmacy_Yes 9.270900e-01 9.761800e-01
## Naloxone_Pharmacy_No 9.705700e-01 1.008440e+00
## Medical_Marijuana 1.018370e+00 1.065010e+00
## Recreational_Marijuana 9.188900e-01 9.638900e-01
## GSL 9.903700e-01 1.034430e+00
## PDMP 9.420500e-01 9.806800e-01
## Medicaid_Expansion 1.067560e+00 1.104180e+00
## Intervention 1.026660e+00 1.063780e+00
## Number of States with DIH Prosecutions 9.927000e-01 1.003700e+00
## Intercept/Alabama 3.591081e-05 4.964147e-05
## RR_95_CI_UB standard_error
## Naloxone_Pharmacy_Yes 1.027870e+00 0.0263300
## Naloxone_Pharmacy_No 1.047780e+00 0.0195300
## Medical_Marijuana 1.113780e+00 0.0228400
## Recreational_Marijuana 1.011100e+00 0.0244000
## GSL 1.080460e+00 0.0222100
## PDMP 1.020880e+00 0.0205000
## Medicaid_Expansion 1.142060e+00 0.0172100
## Intervention 1.102230e+00 0.0181200
## Number of States with DIH Prosecutions 1.014820e+00 0.0056200
## Intercept/Alabama 6.862211e-05 0.1651981
#save the table into a CSV
# write.csv(round(main_analysis_covariate_table, 3), "./Data/coefficients_covariates_1_18_22_full_data_unintentional_od.csv")
Attributable Deaths
############################## Main Analysis: Number of Overdose Deaths Attributed to Intervention ###############################
#find the number of deaths attributable to the intervention
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_main_analysis<-main_analysis_data[which(main_analysis_data$Intervention_Redefined>0),]
#compute the probability of overdose had intervention not occurred
prob_od_no_int_main_analysis<-expit(-coef(main_analysis_model)["Intervention_Redefined"]*
attr_deaths_anlys_main_analysis$Intervention_Redefined
+ logit(attr_deaths_anlys_main_analysis$imputed_deaths/
attr_deaths_anlys_main_analysis$population))
#compute the lower and upper bounds of 95% CI of probability of overdose had intervention not occurred
#here, we compute the lower and upper bounds of the 95% CI of all the coefficients using the standard error from the model
coef_lb<-main_analysis_full_table$lb_coef
coef_ub<-main_analysis_full_table$ub_coef
names(coef_lb) <- names(coef_ub) <- rownames(main_analysis_full_table)
#we then calculate the upper and lower bounds of the probability of overdose death had intervention not occurred by using
#the lower and upper bounds of the coefficient of the intervention variable
prob_od_no_int_LB_main_analysis<-expit(-coef_lb[names(coef_lb) ==
"Intervention_Redefined"]*attr_deaths_anlys_main_analysis$Intervention_Redefined
+ logit(attr_deaths_anlys_main_analysis$imputed_deaths/attr_deaths_anlys_main_analysis$population))
prob_od_no_int_UB_main_analysis<-expit(-coef_ub[names(coef_ub) ==
"Intervention_Redefined"]*attr_deaths_anlys_main_analysis$Intervention_Redefined
+ logit(attr_deaths_anlys_main_analysis$imputed_deaths/attr_deaths_anlys_main_analysis$population))
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(attr_deaths_anlys_main_analysis$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths that attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_main_analysis$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_main_analysis$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_main_analysis$imputed_deaths[time_point_index]
- prob_od_no_int_main_analysis[time_point_index]*
attr_deaths_anlys_main_analysis$population[time_point_index])
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-sum(attr_deaths_anlys_main_analysis$imputed_deaths[time_point_index]
- prob_od_no_int_LB_main_analysis[time_point_index]*
attr_deaths_anlys_main_analysis$population[time_point_index])
num_attr_od_UB[index]<-sum(attr_deaths_anlys_main_analysis$imputed_deaths[time_point_index]
- prob_od_no_int_UB_main_analysis[time_point_index]*
attr_deaths_anlys_main_analysis$population[time_point_index])
index<-index + 1
}
num_attr_od_main_analysis<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_main_analysis$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_main_analysis$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_main_analysis$Num_Attr_Deaths)
## [1] 33114.98
summary(num_attr_od_main_analysis$Num_Attr_Deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.971 355.713 702.014 827.874 1154.626 1931.467
num_attr_od_main_analysis$Time_Start<-as.Date(num_attr_od_main_analysis$Time_Start)
#compute the 95% CI for the total
sum(num_attr_od_main_analysis$Num_Attr_Deaths_LB)
## [1] 14344.55
sum(num_attr_od_main_analysis$Num_Attr_Deaths_UB)
## [1] 51233.35
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_main_analysis<-num_attr_od_main_analysis %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths), death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_main_analysis$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 29.82 753.33 1409.54 1655.75 2306.53 3684.37
summary(yearly_num_Attr_Deaths_main_analysis$death_lb)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.88 326.25 610.58 717.23 999.19 1596.09
summary(yearly_num_Attr_Deaths_main_analysis$death_ub)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 46.26 1165.75 2180.75 2561.67 3568.32 5699.82
Sensitivity Analysis 1: Confounding by Indication
Analysis
############################## Sensitivity Analysis 1: Confounding by Indication Analysis ###############################
#create a variable that is equal to 1 just before intervention
#initialize the column to all zeros
main_analysis_data$justBeforeIntervention<-0
#for each state, we first subset the data so it only contains the state's data
for(state in unique(main_analysis_data$State)){
state_data<-main_analysis_data[main_analysis_data$State == state,]
#then, we find the first time point where intervention occurred
index_first_intervention<-which(state_data$Intervention_Redefined>0)[1]
#impute a 1 for the time point right before when intervention first occurs
main_analysis_data$justBeforeIntervention[main_analysis_data$State == state][index_first_intervention-1]<-1
}
#subset the data so that we are only looking at the periods before the intervention occurs for each state
sensitivity_anlys_conf_by_indication_data<-data.frame()
for(state in unique(main_analysis_data$State)){
state_data<-main_analysis_data[main_analysis_data$State == state,]
#we don't include these states because Georgia and Ohio have intervention in 2000
#Hawaii is in this list because it doesn't have an intervention, so we will encounter an error
#if the state is Hawaii, we'll go to the else if condition
if(!(state %in% c("Hawaii", "Georgia", "Ohio"))){
#look for the index where it is just before the intervention
index_first_intervention<-which(state_data$justBeforeIntervention>0)
#add the rows that occur before the intervention to the sensitivity analysis data
sensitivity_anlys_conf_by_indication_data<-rbind(sensitivity_anlys_conf_by_indication_data, state_data[1:(index_first_intervention),])
}else if(state == "Hawaii"){
#Hawaii doesn't have an intervention, so we want to include all the rows of Hawaii
sensitivity_anlys_conf_by_indication_data<-rbind(sensitivity_anlys_conf_by_indication_data, state_data)
}
}
#run the analysis for the sensitivity analysis
sensitivity_anlys_conf_by_indication<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region), k = 7) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
justBeforeIntervention +
num_states_w_intervention,
data = sensitivity_anlys_conf_by_indication_data, family = "binomial")
stargazer(sensitivity_anlys_conf_by_indication, type = "html", dep.var.labels = "Unintentional Overdose Deaths")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Deaths
|
|
|
|
StateAlaska
|
0.583***
|
|
|
(0.045)
|
|
|
|
|
StateArizona
|
0.577***
|
|
|
(0.028)
|
|
|
|
|
StateArkansas
|
-0.328***
|
|
|
(0.037)
|
|
|
|
|
StateCalifornia
|
0.067
|
|
|
(0.046)
|
|
|
|
|
StateColorado
|
0.385***
|
|
|
(0.035)
|
|
|
|
|
StateConnecticut
|
0.783***
|
|
|
(0.041)
|
|
|
|
|
StateDelaware
|
0.275***
|
|
|
(0.039)
|
|
|
|
|
StateFlorida
|
0.700***
|
|
|
(0.047)
|
|
|
|
|
StateHawaii
|
-0.078*
|
|
|
(0.043)
|
|
|
|
|
StateIdaho
|
0.028
|
|
|
(0.038)
|
|
|
|
|
StateIllinois
|
0.807***
|
|
|
(0.040)
|
|
|
|
|
StateIndiana
|
0.031
|
|
|
(0.033)
|
|
|
|
|
StateIowa
|
-0.694***
|
|
|
(0.072)
|
|
|
|
|
StateKansas
|
0.015
|
|
|
(0.042)
|
|
|
|
|
StateKentucky
|
0.772***
|
|
|
(0.028)
|
|
|
|
|
StateLouisiana
|
0.501***
|
|
|
(0.041)
|
|
|
|
|
StateMaine
|
0.459***
|
|
|
(0.048)
|
|
|
|
|
StateMaryland
|
-1.272***
|
|
|
(0.099)
|
|
|
|
|
StateMassachusetts
|
0.153***
|
|
|
(0.036)
|
|
|
|
|
StateMichigan
|
0.110***
|
|
|
(0.036)
|
|
|
|
|
StateMinnesota
|
-0.445***
|
|
|
(0.042)
|
|
|
|
|
StateMississippi
|
0.109***
|
|
|
(0.031)
|
|
|
|
|
StateMissouri
|
0.390***
|
|
|
(0.037)
|
|
|
|
|
StateMontana
|
-0.175*
|
|
|
(0.091)
|
|
|
|
|
StateNebraska
|
-0.835***
|
|
|
(0.047)
|
|
|
|
|
StateNevada
|
0.868***
|
|
|
(0.043)
|
|
|
|
|
StateNew Hampshire
|
0.229***
|
|
|
(0.045)
|
|
|
|
|
StateNew Jersey
|
0.876***
|
|
|
(0.043)
|
|
|
|
|
StateNew Mexico
|
1.360***
|
|
|
(0.040)
|
|
|
|
|
StateNew York
|
0.223***
|
|
|
(0.034)
|
|
|
|
|
StateNorth Carolina
|
0.439***
|
|
|
(0.032)
|
|
|
|
|
StateNorth Dakota
|
-1.175***
|
|
|
(0.078)
|
|
|
|
|
StateOklahoma
|
0.662***
|
|
|
(0.030)
|
|
|
|
|
StateOregon
|
0.137***
|
|
|
(0.040)
|
|
|
|
|
StatePennsylvania
|
1.047***
|
|
|
(0.051)
|
|
|
|
|
StateRhode Island
|
0.073
|
|
|
(0.047)
|
|
|
|
|
StateSouth Carolina
|
0.291***
|
|
|
(0.029)
|
|
|
|
|
StateSouth Dakota
|
-1.056***
|
|
|
(0.064)
|
|
|
|
|
StateTennessee
|
0.571***
|
|
|
(0.029)
|
|
|
|
|
StateTexas
|
0.541***
|
|
|
(0.043)
|
|
|
|
|
StateUtah
|
-0.505***
|
|
|
(0.064)
|
|
|
|
|
StateVermont
|
0.153**
|
|
|
(0.061)
|
|
|
|
|
StateVirginia
|
0.391***
|
|
|
(0.039)
|
|
|
|
|
StateWashington
|
0.535***
|
|
|
(0.037)
|
|
|
|
|
StateWest Virginia
|
0.890***
|
|
|
(0.030)
|
|
|
|
|
StateWisconsin
|
0.169***
|
|
|
(0.045)
|
|
|
|
|
StateWyoming
|
0.085
|
|
|
(0.065)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.022
|
|
|
(0.072)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
-0.296***
|
|
|
(0.028)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.033
|
|
|
(0.022)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.157
|
|
|
(0.123)
|
|
|
|
|
GSL_Redefined
|
-0.026
|
|
|
(0.034)
|
|
|
|
|
PDMP_Redefined
|
-0.084***
|
|
|
(0.015)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.107*
|
|
|
(0.061)
|
|
|
|
|
justBeforeIntervention
|
-0.048***
|
|
|
(0.012)
|
|
|
|
|
num_states_w_intervention
|
-0.012***
|
|
|
(0.004)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
Constant
|
-10.000***
|
|
|
(0.064)
|
|
|
|
|
|
|
Observations
|
833
|
|
Adjusted R2
|
0.867
|
|
Log Likelihood
|
-4,759.642
|
|
UBRE
|
4.342
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
sensitivity_anlys_conf_by_indication_w_basis_functions <- data.frame(predict(sensitivity_anlys_conf_by_indication, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_conf_by_indication_coefficient_values <- coef(sensitivity_anlys_conf_by_indication)
#type = "response" to get the estimated probabilities
sensitivity_anlys_conf_by_indication_pred_prob <- predict(sensitivity_anlys_conf_by_indication,
newdata = sensitivity_anlys_conf_by_indication_data, type = "response")
sensitivity_anlys_conf_by_indication_sd_and_ci <- compute_sd_and_CI(sensitivity_anlys_conf_by_indication_w_basis_functions,
sensitivity_anlys_conf_by_indication_data$population,
sensitivity_anlys_conf_by_indication_data$imputed_deaths,
sensitivity_anlys_conf_by_indication_pred_prob,
sensitivity_anlys_conf_by_indication_coefficient_values)
round(sensitivity_anlys_conf_by_indication_sd_and_ci, 3)
## lb_coef coef_values ub_coef
## (Intercept) -10.337 -10.000 -9.663
## StateAlaska 0.424 0.583 0.742
## StateArizona 0.453 0.577 0.700
## StateArkansas -0.495 -0.328 -0.160
## StateCalifornia -0.421 0.067 0.554
## StateColorado 0.244 0.385 0.527
## StateConnecticut -3.795 0.783 5.362
## StateDelaware 0.129 0.275 0.421
## StateFlorida 0.484 0.700 0.917
## StateHawaii -0.226 -0.078 0.069
## StateIdaho -0.102 0.028 0.158
## StateIllinois 0.653 0.807 0.962
## StateIndiana -0.107 0.031 0.168
## StateIowa -0.839 -0.694 -0.550
## StateKansas -0.131 0.015 0.161
## StateKentucky 0.641 0.772 0.903
## StateLouisiana 0.345 0.501 0.658
## StateMaine -4.164 0.459 5.081
## StateMaryland -1.508 -1.272 -1.035
## StateMassachusetts -4.531 0.153 4.837
## StateMichigan -0.026 0.110 0.247
## StateMinnesota -0.603 -0.445 -0.288
## StateMississippi -0.019 0.109 0.237
## StateMissouri 0.260 0.390 0.521
## StateMontana -0.354 -0.175 0.004
## StateNebraska -0.975 -0.835 -0.696
## StateNevada 0.722 0.868 1.013
## StateNew Hampshire -4.406 0.229 4.863
## StateNew Jersey -3.733 0.876 5.485
## StateNew Mexico 1.112 1.360 1.608
## StateNew York -4.368 0.223 4.815
## StateNorth Carolina 0.318 0.439 0.561
## StateNorth Dakota -1.432 -1.175 -0.918
## StateOklahoma 0.532 0.662 0.792
## StateOregon -0.012 0.137 0.287
## StatePennsylvania -3.565 1.047 5.660
## StateRhode Island -4.497 0.073 4.643
## StateSouth Carolina 0.162 0.291 0.419
## StateSouth Dakota -1.242 -1.056 -0.870
## StateTennessee 0.449 0.571 0.694
## StateTexas 0.384 0.541 0.699
## StateUtah -0.679 -0.505 -0.330
## StateVermont -4.484 0.153 4.791
## StateVirginia 0.260 0.391 0.522
## StateWashington 0.386 0.535 0.683
## StateWest Virginia 0.726 0.890 1.054
## StateWisconsin 0.033 0.169 0.305
## StateWyoming -0.115 0.085 0.285
## Naloxone_Pharmacy_Yes_Redefined -0.242 -0.022 0.198
## Naloxone_Pharmacy_No_Redefined -0.541 -0.296 -0.051
## Medical_Marijuana_Redefined -0.047 0.033 0.112
## Recreational_Marijuana_Redefined -0.444 -0.157 0.129
## GSL_Redefined -0.138 -0.026 0.086
## PDMP_Redefined -0.140 -0.084 -0.028
## Medicaid_Expansion_Redefined -0.071 0.107 0.285
## justBeforeIntervention -0.128 -0.048 0.032
## num_states_w_intervention -0.030 -0.012 0.006
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.101 0.179 0.256
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.451 0.614 0.776
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.708 1.056 1.405
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.819 1.332 1.846
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.048 1.636 2.223
## s(Time_Period_ID):as.factor(Region)Midwest.6 -0.239 1.983 4.205
## s(Time_Period_ID):as.factor(Region)Northeast.1 -2.314 -0.191 1.933
## s(Time_Period_ID):as.factor(Region)Northeast.2 -2.468 0.608 3.684
## s(Time_Period_ID):as.factor(Region)Northeast.3 -2.711 0.992 4.696
## s(Time_Period_ID):as.factor(Region)Northeast.4 -2.532 1.835 6.203
## s(Time_Period_ID):as.factor(Region)Northeast.5 -111.053 2.801 116.654
## s(Time_Period_ID):as.factor(Region)Northeast.6 -714.106 3.800 721.705
## s(Time_Period_ID):as.factor(Region)South.1 0.223 0.293 0.363
## s(Time_Period_ID):as.factor(Region)South.2 0.469 0.619 0.769
## s(Time_Period_ID):as.factor(Region)South.3 0.538 0.878 1.218
## s(Time_Period_ID):as.factor(Region)South.4 0.478 0.976 1.474
## s(Time_Period_ID):as.factor(Region)South.5 1.320 1.967 2.615
## s(Time_Period_ID):as.factor(Region)South.6 4.724 8.208 11.692
## s(Time_Period_ID):as.factor(Region)West.1 -0.040 0.096 0.231
## s(Time_Period_ID):as.factor(Region)West.2 0.229 0.382 0.535
## s(Time_Period_ID):as.factor(Region)West.3 0.259 0.594 0.929
## s(Time_Period_ID):as.factor(Region)West.4 0.293 0.788 1.284
## s(Time_Period_ID):as.factor(Region)West.5 0.517 1.090 1.664
## s(Time_Period_ID):as.factor(Region)West.6 0.829 1.440 2.052
## exp_lb exp_coef exp_ub
## (Intercept) 0.000 0.000 0.000000e+00
## StateAlaska 1.528 1.792 2.101000e+00
## StateArizona 1.573 1.780 2.014000e+00
## StateArkansas 0.609 0.721 8.520000e-01
## StateCalifornia 0.657 1.069 1.740000e+00
## StateColorado 1.276 1.470 1.694000e+00
## StateConnecticut 0.022 2.189 2.131030e+02
## StateDelaware 1.138 1.317 1.524000e+00
## StateFlorida 1.623 2.015 2.501000e+00
## StateHawaii 0.798 0.925 1.072000e+00
## StateIdaho 0.903 1.029 1.172000e+00
## StateIllinois 1.922 2.242 2.616000e+00
## StateIndiana 0.899 1.031 1.183000e+00
## StateIowa 0.432 0.499 5.770000e-01
## StateKansas 0.877 1.015 1.175000e+00
## StateKentucky 1.898 2.164 2.468000e+00
## StateLouisiana 1.412 1.651 1.931000e+00
## StateMaine 0.016 1.582 1.609710e+02
## StateMaryland 0.221 0.280 3.550000e-01
## StateMassachusetts 0.011 1.165 1.261010e+02
## StateMichigan 0.974 1.117 1.280000e+00
## StateMinnesota 0.547 0.641 7.500000e-01
## StateMississippi 0.981 1.115 1.268000e+00
## StateMissouri 1.296 1.477 1.683000e+00
## StateMontana 0.702 0.839 1.004000e+00
## StateNebraska 0.377 0.434 4.980000e-01
## StateNevada 2.059 2.381 2.754000e+00
## StateNew Hampshire 0.012 1.257 1.294130e+02
## StateNew Jersey 0.024 2.401 2.409770e+02
## StateNew Mexico 3.040 3.896 4.994000e+00
## StateNew York 0.013 1.250 1.233090e+02
## StateNorth Carolina 1.375 1.552 1.752000e+00
## StateNorth Dakota 0.239 0.309 3.990000e-01
## StateOklahoma 1.702 1.939 2.209000e+00
## StateOregon 0.988 1.147 1.332000e+00
## StatePennsylvania 0.028 2.850 2.871560e+02
## StateRhode Island 0.011 1.076 1.038730e+02
## StateSouth Carolina 1.176 1.338 1.521000e+00
## StateSouth Dakota 0.289 0.348 4.190000e-01
## StateTennessee 1.566 1.770 2.001000e+00
## StateTexas 1.468 1.718 2.011000e+00
## StateUtah 0.507 0.604 7.190000e-01
## StateVermont 0.011 1.166 1.203630e+02
## StateVirginia 1.297 1.479 1.686000e+00
## StateWashington 1.471 1.707 1.981000e+00
## StateWest Virginia 2.066 2.434 2.868000e+00
## StateWisconsin 1.034 1.184 1.357000e+00
## StateWyoming 0.891 1.089 1.329000e+00
## Naloxone_Pharmacy_Yes_Redefined 0.785 0.978 1.219000e+00
## Naloxone_Pharmacy_No_Redefined 0.582 0.744 9.500000e-01
## Medical_Marijuana_Redefined 0.954 1.033 1.119000e+00
## Recreational_Marijuana_Redefined 0.642 0.854 1.138000e+00
## GSL_Redefined 0.871 0.974 1.090000e+00
## PDMP_Redefined 0.870 0.920 9.730000e-01
## Medicaid_Expansion_Redefined 0.931 1.113 1.330000e+00
## justBeforeIntervention 0.879 0.953 1.032000e+00
## num_states_w_intervention 0.970 0.988 1.006000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 1.106 1.195 1.292000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.2 1.570 1.847 2.174000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.3 2.030 2.876 4.074000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 2.268 3.790 6.333000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 2.853 5.132 9.233000e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.787 7.264 6.703600e+01
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.099 0.826 6.912000e+00
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.085 1.837 3.981100e+01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.066 2.697 1.094900e+02
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.079 6.268 4.943340e+02
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.000 16.460 4.595977e+50
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.000 44.684 Inf
## s(Time_Period_ID):as.factor(Region)South.1 1.250 1.341 1.438000e+00
## s(Time_Period_ID):as.factor(Region)South.2 1.599 1.857 2.157000e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.712 2.405 3.380000e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.614 2.655 4.368000e+00
## s(Time_Period_ID):as.factor(Region)South.5 3.742 7.152 1.366900e+01
## s(Time_Period_ID):as.factor(Region)South.6 112.596 3669.189 1.195687e+05
## s(Time_Period_ID):as.factor(Region)West.1 0.961 1.100 1.259000e+00
## s(Time_Period_ID):as.factor(Region)West.2 1.258 1.465 1.707000e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.295 1.811 2.533000e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.340 2.200 3.611000e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.677 2.975 5.279000e+00
## s(Time_Period_ID):as.factor(Region)West.6 2.290 4.221 7.780000e+00
## sd_coef
## (Intercept) 0.172
## StateAlaska 0.081
## StateArizona 0.063
## StateArkansas 0.086
## StateCalifornia 0.249
## StateColorado 0.072
## StateConnecticut 2.336
## StateDelaware 0.074
## StateFlorida 0.110
## StateHawaii 0.075
## StateIdaho 0.066
## StateIllinois 0.079
## StateIndiana 0.070
## StateIowa 0.074
## StateKansas 0.075
## StateKentucky 0.067
## StateLouisiana 0.080
## StateMaine 2.358
## StateMaryland 0.121
## StateMassachusetts 2.390
## StateMichigan 0.070
## StateMinnesota 0.080
## StateMississippi 0.065
## StateMissouri 0.067
## StateMontana 0.091
## StateNebraska 0.071
## StateNevada 0.074
## StateNew Hampshire 2.364
## StateNew Jersey 2.351
## StateNew Mexico 0.127
## StateNew York 2.343
## StateNorth Carolina 0.062
## StateNorth Dakota 0.131
## StateOklahoma 0.066
## StateOregon 0.076
## StatePennsylvania 2.353
## StateRhode Island 2.332
## StateSouth Carolina 0.066
## StateSouth Dakota 0.095
## StateTennessee 0.063
## StateTexas 0.080
## StateUtah 0.089
## StateVermont 2.366
## StateVirginia 0.067
## StateWashington 0.076
## StateWest Virginia 0.084
## StateWisconsin 0.069
## StateWyoming 0.102
## Naloxone_Pharmacy_Yes_Redefined 0.112
## Naloxone_Pharmacy_No_Redefined 0.125
## Medical_Marijuana_Redefined 0.041
## Recreational_Marijuana_Redefined 0.146
## GSL_Redefined 0.057
## PDMP_Redefined 0.029
## Medicaid_Expansion_Redefined 0.091
## justBeforeIntervention 0.041
## num_states_w_intervention 0.009
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.040
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.083
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.178
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.262
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.300
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.134
## s(Time_Period_ID):as.factor(Region)Northeast.1 1.084
## s(Time_Period_ID):as.factor(Region)Northeast.2 1.569
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.890
## s(Time_Period_ID):as.factor(Region)Northeast.4 2.228
## s(Time_Period_ID):as.factor(Region)Northeast.5 58.089
## s(Time_Period_ID):as.factor(Region)Northeast.6 366.278
## s(Time_Period_ID):as.factor(Region)South.1 0.036
## s(Time_Period_ID):as.factor(Region)South.2 0.076
## s(Time_Period_ID):as.factor(Region)South.3 0.174
## s(Time_Period_ID):as.factor(Region)South.4 0.254
## s(Time_Period_ID):as.factor(Region)South.5 0.330
## s(Time_Period_ID):as.factor(Region)South.6 1.778
## s(Time_Period_ID):as.factor(Region)West.1 0.069
## s(Time_Period_ID):as.factor(Region)West.2 0.078
## s(Time_Period_ID):as.factor(Region)West.3 0.171
## s(Time_Period_ID):as.factor(Region)West.4 0.253
## s(Time_Period_ID):as.factor(Region)West.5 0.293
## s(Time_Period_ID):as.factor(Region)West.6 0.312
Compile Results
############################## Sensitivity Analysis 1: Make Data Frame of Results and 95% CI ###############################
#store the coefficients of all the terms into a table
sensitivity_anlys_conf_by_indication_full_table<-sensitivity_anlys_conf_by_indication_sd_and_ci
head(sensitivity_anlys_conf_by_indication_full_table)
## lb_coef coef_values ub_coef exp_lb exp_coef
## (Intercept) -10.3365113 -9.99967873 -9.6628462 3.242726e-05 4.541452e-05
## StateAlaska 0.4240940 0.58324804 0.7424021 1.528205e+00 1.791849e+00
## StateArizona 0.4532548 0.57668617 0.7001176 1.573425e+00 1.780130e+00
## StateArkansas -0.4954064 -0.32779812 -0.1601898 6.093232e-01 7.205085e-01
## StateCalifornia -0.4205776 0.06653619 0.5536500 6.566674e-01 1.068800e+00
## StateColorado 0.2436810 0.38539654 0.5271121 1.275937e+00 1.470197e+00
## exp_ub sd_coef
## (Intercept) 6.360324e-05 0.17185333
## StateAlaska 2.100976e+00 0.08120107
## StateArizona 2.013989e+00 0.06297520
## StateArkansas 8.519821e-01 0.08551445
## StateCalifornia 1.739591e+00 0.24852746
## StateColorado 1.694033e+00 0.07230384
#store a vector of the covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"justBeforeIntervention",
"num_states_w_intervention")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_conf_by_indication_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_conf_by_indication_full_table)[i] %in% covariates)){
#we see if it is a state effect
if(substr(rownames(sensitivity_anlys_conf_by_indication_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_conf_by_indication_full_table)[i]<-substr(rownames(sensitivity_anlys_conf_by_indication_full_table)[i],
start = 6,
stop =
nchar(rownames(sensitivity_anlys_conf_by_indication_full_table)[i]))
}else if(rownames(sensitivity_anlys_conf_by_indication_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_conf_by_indication_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_conf_by_indication_full_table)[i], start = 1, stop = 35) ==
"s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_conf_by_indication_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_conf_by_indication_full_table)[i],
start = 36,
stop =
nchar(rownames(sensitivity_anlys_conf_by_indication_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_conf_by_indication_full_table)
## lb_coef coef_values ub_coef exp_lb exp_coef
## Intercept/Alabama -10.3365113 -9.99967873 -9.6628462 3.242726e-05 4.541452e-05
## Alaska 0.4240940 0.58324804 0.7424021 1.528205e+00 1.791849e+00
## Arizona 0.4532548 0.57668617 0.7001176 1.573425e+00 1.780130e+00
## Arkansas -0.4954064 -0.32779812 -0.1601898 6.093232e-01 7.205085e-01
## California -0.4205776 0.06653619 0.5536500 6.566674e-01 1.068800e+00
## Colorado 0.2436810 0.38539654 0.5271121 1.275937e+00 1.470197e+00
## exp_ub sd_coef
## Intercept/Alabama 6.360324e-05 0.17185333
## Alaska 2.100976e+00 0.08120107
## Arizona 2.013989e+00 0.06297520
## Arkansas 8.519821e-01 0.08551445
## California 1.739591e+00 0.24852746
## Colorado 1.694033e+00 0.07230384
tail(sensitivity_anlys_conf_by_indication_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.1 -0.03956343 0.09557024 0.2307039 0.961209
## Smoothed Time for Region West.2 0.22926099 0.38208961 0.5349182 1.257670
## Smoothed Time for Region West.3 0.25873610 0.59403937 0.9293426 1.295292
## Smoothed Time for Region West.4 0.29266342 0.78831630 1.2839692 1.339992
## Smoothed Time for Region West.5 0.51706397 1.09040278 1.6637416 1.677096
## Smoothed Time for Region West.6 0.82861538 1.44006651 2.0515176 2.290146
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.1 1.100286 1.259486 0.06894575
## Smoothed Time for Region West.2 1.465343 1.707309 0.07797378
## Smoothed Time for Region West.3 1.811290 2.532844 0.17107310
## Smoothed Time for Region West.4 2.199690 3.610944 0.25288412
## Smoothed Time for Region West.5 2.975472 5.279026 0.29251980
## Smoothed Time for Region West.6 4.220977 7.779699 0.31196486
#export the sensitivity analysis confounding by indication full table of estimates as CSV
# write.csv(round(sensitivity_anlys_conf_by_indication_full_table,3), "./Data/coefficients_JustBeforeInd_9_6_21_full_data.csv")
#export out a table with just the covariates:
#find the rows in the full table which contain estimates for the covariates and extract them
covariate_Index<-which(rownames(sensitivity_anlys_conf_by_indication_full_table) %in% covariates)
sensitivity_anlys_conf_by_indication_covariate_table<-(round(sensitivity_anlys_conf_by_indication_full_table[covariate_Index,],5))
#rename these variables so they look nicer
rownames(sensitivity_anlys_conf_by_indication_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Just Before Indicator",
"Number of States w DIH Prosecution")
#put the covariate rows on top and the rest of the data at the bottom
sensitivity_anlys_conf_by_indication_covariate_table<-rbind(sensitivity_anlys_conf_by_indication_covariate_table,
sensitivity_anlys_conf_by_indication_full_table[-covariate_Index,])
#extract the columns that gives the odds ratio estimates
sensitivity_anlys_conf_by_indication_covariate_table<-sensitivity_anlys_conf_by_indication_covariate_table[,
-which(colnames(sensitivity_anlys_conf_by_indication_covariate_table) %in%
c("lb_coef",
"coef_values",
"ub_coef"))]
colnames(sensitivity_anlys_conf_by_indication_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates","RR_95_CI_UB", "standard_error")
head(sensitivity_anlys_conf_by_indication_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates
## Naloxone_Pharmacy_Yes 7.850400e-01 9.781900e-01
## Naloxone_Pharmacy_No 5.819800e-01 7.436800e-01
## Medical_Marijuana 9.541500e-01 1.033210e+00
## Recreational_Marijuana 6.416900e-01 8.544300e-01
## GSL 8.713500e-01 9.744700e-01
## PDMP 8.695300e-01 9.196300e-01
## Medicaid_Expansion 9.314400e-01 1.113000e+00
## Just Before Indicator 8.794800e-01 9.527800e-01
## Number of States w DIH Prosecution 9.700700e-01 9.880900e-01
## Intercept/Alabama 3.242726e-05 4.541452e-05
## RR_95_CI_UB standard_error
## Naloxone_Pharmacy_Yes 1.218860e+00 0.1122300
## Naloxone_Pharmacy_No 9.503200e-01 0.1250900
## Medical_Marijuana 1.118830e+00 0.0406200
## Recreational_Marijuana 1.137690e+00 0.1460800
## GSL 1.089790e+00 0.0570700
## PDMP 9.726200e-01 0.0285800
## Medicaid_Expansion 1.329950e+00 0.0908600
## Just Before Indicator 1.032190e+00 0.0408400
## Number of States w DIH Prosecution 1.006450e+00 0.0093900
## Intercept/Alabama 6.360324e-05 0.1718533
#export the covariate table into a CSV file
# write.csv(round(sensitivity_anlys_conf_by_indication_covariate_table,3), "./Data/covariates_just_before_intervention_9_6_21_full_data.csv")
Sensitivity Analysis 2: Exclude States with At Least 75% Missing Monthly Data
Analysis
############################## Exclude States from Analysis Based on Missing Data ###############################
#subset the data to be between 2000 and 2019
overdose_monthly_imputed<-read.csv("./Data/od_data_interpolated_unintentional_1999_2019_age_17_up_9_6_21.csv")
od_2000_to_2019<-overdose_monthly_imputed[overdose_monthly_imputed$Year>=2000 & overdose_monthly_imputed$Year<=2019,]
#convert the date to Date objects and the number of deaths to numeric
od_2000_to_2019$Date<-as.Date(as.yearmon(od_2000_to_2019$Month.Code, format = "%Y/%m"))
od_2000_to_2019$Deaths<-as.numeric(od_2000_to_2019$Deaths)
#plot to look at the trend of the outcome and see how much data is missing
ggplot(od_2000_to_2019, aes(x = Date, y = Deaths)) + geom_line() + facet_wrap(vars(State))

#find the states where the proportion of monthly missing data for years 2000 to 2017 is greater than 75%
statesToExcludeCriteria<-sapply(unique(od_2000_to_2019$State), function(state){
mean(is.na(od_2000_to_2019$Deaths[od_2000_to_2019$State == state]))>.75})
statesToExclude<-unique(od_2000_to_2019$State)[statesToExcludeCriteria]
#states excluded: [1] "Alaska" "Montana" "Nebraska" "North Dakota" "South Dakota" "Vermont" "Wyoming"
#calculate the median (and IQR) of missingnness from resulting data
summary_missingness <- od_2000_to_2019 %>%
group_by(State) %>%
summarise(missing = mean(is.na(Deaths)))
median(summary_missingness$missing[!summary_missingness$State %in% statesToExclude])
## [1] 0.02083333
IQR(summary_missingness$missing[!summary_missingness$State %in% statesToExclude])
## [1] 0.1979167
summary(summary_missingness$missing[!summary_missingness$State %in% statesToExclude])
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00000 0.00000 0.02083 0.12791 0.19792 0.64583
#include only the states that are not excluded
sensitivity_anlys_exclude_states_data<-main_analysis_data[!(main_analysis_data$State %in% statesToExclude), ]
sensitivity_anlys_exclude_states_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
Intervention_Redefined +
num_states_w_intervention,
data = sensitivity_anlys_exclude_states_data, family = "binomial")
stargazer(sensitivity_anlys_exclude_states_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateArizona
|
0.317***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.388***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.161***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.099***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.185***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.433***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.252***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.071***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.222***
|
|
|
(0.026)
|
|
|
|
|
StateIdaho
|
-0.135***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.017
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.087***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.741***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.328***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.641***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.294***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.146***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.066***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.207***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.020
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.617***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.098***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.196***
|
|
|
(0.015)
|
|
|
|
|
StateNevada
|
0.440***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.258***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.106***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.628***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.242***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.176***
|
|
|
(0.013)
|
|
|
|
|
StateOhio
|
0.453***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.385***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.191***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.434***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.238***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.223***
|
|
|
(0.015)
|
|
|
|
|
StateTennessee
|
0.436***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.205***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.071***
|
|
|
(0.018)
|
|
|
|
|
StateVirginia
|
-0.114***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.079***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.877***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.038***
|
|
|
(0.015)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.021***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.016**
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.061***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.040***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.034***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.016***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.099***
|
|
|
(0.006)
|
|
|
|
|
Intervention_Redefined
|
0.066***
|
|
|
(0.005)
|
|
|
|
|
num_states_w_intervention
|
0.004**
|
|
|
(0.002)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.919***
|
|
|
(0.054)
|
|
|
|
|
|
|
Observations
|
1,720
|
|
Adjusted R2
|
0.910
|
|
Log Likelihood
|
-15,830.150
|
|
UBRE
|
10.177
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
sensitivity_anlys_exclude_states_w_basis_functions <- data.frame(predict(sensitivity_anlys_exclude_states_model, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_exclude_states_coefficient_values <- coef(sensitivity_anlys_exclude_states_model)
#type = "response" to get the estimated probabilities
sensitivity_anlys_exclude_states_pred_prob <- predict(sensitivity_anlys_exclude_states_model,
newdata = sensitivity_anlys_exclude_states_data, type = "response")
sensitivity_anlys_exclude_states_sd_and_ci <- compute_sd_and_CI(sensitivity_anlys_exclude_states_w_basis_functions,
sensitivity_anlys_exclude_states_data$population,
sensitivity_anlys_exclude_states_data$imputed_deaths,
sensitivity_anlys_exclude_states_pred_prob,
sensitivity_anlys_exclude_states_coefficient_values)
sensitivity_anlys_exclude_states_sd_and_ci
## lb_coef coef_values
## (Intercept) -10.245735090 -9.918643258
## StateArizona 0.246523354 0.316725710
## StateArkansas -0.477800866 -0.388084956
## StateCalifornia -0.242494772 -0.160892359
## StateColorado 0.016381426 0.099318288
## StateConnecticut 0.103237359 0.185120651
## StateDelaware 0.303663331 0.433148179
## StateFlorida 0.178066663 0.252471971
## StateGeorgia -0.136374733 -0.071188132
## StateHawaii -0.324949633 -0.222198803
## StateIdaho -0.222272376 -0.135263034
## StateIllinois -0.103344981 -0.017350261
## StateIndiana 0.017045663 0.087171714
## StateIowa -0.826187018 -0.741021443
## StateKansas -0.425237792 -0.327940545
## StateKentucky 0.569408426 0.640991058
## StateLouisiana 0.221947585 0.293600718
## StateMaine 0.049467707 0.145773565
## StateMaryland -1.281417944 -1.066287438
## StateMassachusetts 0.103309746 0.206799776
## StateMichigan -0.091423485 -0.020162301
## StateMinnesota -0.699525156 -0.617458062
## StateMississippi -0.180330104 -0.098325047
## StateMissouri 0.120423889 0.196120205
## StateNevada 0.355126105 0.440388745
## StateNew Hampshire 0.171002436 0.257941877
## StateNew Jersey 0.008443935 0.106397782
## StateNew Mexico 0.540627443 0.628045963
## StateNew York -0.315131001 -0.242084089
## StateNorth Carolina 0.110695606 0.176065361
## StateOhio 0.372087453 0.453160279
## StateOklahoma 0.283727011 0.385097530
## StateOregon -0.276958645 -0.191115600
## StatePennsylvania 0.364323257 0.433568923
## StateRhode Island 0.118156084 0.237753384
## StateSouth Carolina 0.156859554 0.223027170
## StateTennessee 0.369848097 0.435966429
## StateTexas -0.278953575 -0.205419380
## StateUtah -0.063680284 0.070612215
## StateVirginia -0.193232599 -0.114218041
## StateWashington -0.011349178 0.078968109
## StateWest Virginia 0.781718644 0.877071177
## StateWisconsin -0.102248748 -0.038246908
## Naloxone_Pharmacy_Yes_Redefined -0.073637509 -0.021096018
## Naloxone_Pharmacy_No_Redefined -0.022317813 0.016489546
## Medical_Marijuana_Redefined 0.016147242 0.061422709
## Recreational_Marijuana_Redefined -0.088994750 -0.039978794
## GSL_Redefined -0.010484269 0.033561243
## PDMP_Redefined -0.057060993 -0.016143427
## Medicaid_Expansion_Redefined 0.064438593 0.098848278
## Intervention_Redefined 0.029585469 0.065822132
## num_states_w_intervention -0.007369111 0.003768002
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.553979768 -0.320760151
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.273755279 -0.136660846
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.084097552 0.201489069
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.059128309 0.195018101
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.148429888 0.325615250
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.171075424 0.411966347
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.310632149 0.591228957
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.590784218 0.921437068
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.404035509 0.705718627
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.544063179 -0.302186467
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.398716254 -0.245785892
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.056818633 0.177810482
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.156416042 -0.024394345
## s(Time_Period_ID):as.factor(Region)Northeast.5 -0.077726710 0.099489505
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.002137016 0.244348660
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.244516728 0.524999257
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.576647564 0.923088416
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.415278679 0.715195527
## s(Time_Period_ID):as.factor(Region)South.1 -0.288325213 -0.115625559
## s(Time_Period_ID):as.factor(Region)South.2 -0.071225507 0.033456341
## s(Time_Period_ID):as.factor(Region)South.3 0.185016457 0.247534248
## s(Time_Period_ID):as.factor(Region)South.4 0.170786254 0.255312039
## s(Time_Period_ID):as.factor(Region)South.5 0.151592814 0.315500822
## s(Time_Period_ID):as.factor(Region)South.6 0.015073073 0.244094999
## s(Time_Period_ID):as.factor(Region)South.7 0.161304879 0.428254610
## s(Time_Period_ID):as.factor(Region)South.8 0.360866509 0.693066099
## s(Time_Period_ID):as.factor(Region)South.9 0.243631242 0.532558055
## s(Time_Period_ID):as.factor(Region)West.1 -0.349027876 -0.108781975
## s(Time_Period_ID):as.factor(Region)West.2 -0.065694145 0.074075973
## s(Time_Period_ID):as.factor(Region)West.3 0.053105884 0.173629459
## s(Time_Period_ID):as.factor(Region)West.4 0.100205972 0.224201237
## s(Time_Period_ID):as.factor(Region)West.5 -0.009757108 0.173759637
## s(Time_Period_ID):as.factor(Region)West.6 -0.099671123 0.146943655
## s(Time_Period_ID):as.factor(Region)West.7 -0.088749672 0.192590143
## s(Time_Period_ID):as.factor(Region)West.8 -0.042845526 0.304569196
## s(Time_Period_ID):as.factor(Region)West.9 0.129722049 0.422953296
## ub_coef exp_lb
## (Intercept) -9.5915514268 3.550862e-05
## StateArizona 0.3869280661 1.279569e+00
## StateArkansas -0.2983690462 6.201457e-01
## StateCalifornia -0.0792899455 7.846679e-01
## StateColorado 0.1822551502 1.016516e+00
## StateConnecticut 0.2670039418 1.108755e+00
## StateDelaware 0.5626330268 1.354813e+00
## StateFlorida 0.3268772780 1.194905e+00
## StateGeorgia -0.0060015305 8.725156e-01
## StateHawaii -0.1194479736 7.225637e-01
## StateIdaho -0.0482536920 8.006972e-01
## StateIllinois 0.0686444583 9.018158e-01
## StateIndiana 0.1572977640 1.017192e+00
## StateIowa -0.6558558689 4.377151e-01
## StateKansas -0.2306432984 6.536143e-01
## StateKentucky 0.7125736899 1.767221e+00
## StateLouisiana 0.3652538504 1.248506e+00
## StateMaine 0.2420794231 1.050712e+00
## StateMaryland -0.8511569325 2.776433e-01
## StateMassachusetts 0.3102898059 1.108835e+00
## StateMichigan 0.0510988831 9.126311e-01
## StateMinnesota -0.5353909691 4.968212e-01
## StateMississippi -0.0163199896 8.349945e-01
## StateMissouri 0.2718165211 1.127975e+00
## StateNevada 0.5256513840 1.426361e+00
## StateNew Hampshire 0.3448813186 1.186494e+00
## StateNew Jersey 0.2043516277 1.008480e+00
## StateNew Mexico 0.7154644818 1.717084e+00
## StateNew York -0.1690371771 7.296933e-01
## StateNorth Carolina 0.2414351165 1.117055e+00
## StateOhio 0.5342331039 1.450760e+00
## StateOklahoma 0.4864680483 1.328070e+00
## StateOregon -0.1052725541 7.580858e-01
## StatePennsylvania 0.5028145890 1.439539e+00
## StateRhode Island 0.3573506840 1.125420e+00
## StateSouth Carolina 0.2891947864 1.169831e+00
## StateTennessee 0.5020847599 1.447515e+00
## StateTexas -0.1318851841 7.565750e-01
## StateUtah 0.2049047137 9.383049e-01
## StateVirginia -0.0352034826 8.242902e-01
## StateWashington 0.1692853948 9.887150e-01
## StateWest Virginia 0.9724237101 2.185225e+00
## StateWisconsin 0.0257549314 9.028050e-01
## Naloxone_Pharmacy_Yes_Redefined 0.0314454736 9.290084e-01
## Naloxone_Pharmacy_No_Redefined 0.0552969047 9.779294e-01
## Medical_Marijuana_Redefined 0.1066981756 1.016278e+00
## Recreational_Marijuana_Redefined 0.0090371620 9.148504e-01
## GSL_Redefined 0.0776067557 9.895705e-01
## PDMP_Redefined 0.0247741399 9.445365e-01
## Medicaid_Expansion_Redefined 0.1332579639 1.066560e+00
## Intervention_Redefined 0.1020587955 1.030027e+00
## num_states_w_intervention 0.0149051151 9.926580e-01
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.0875405345 5.746582e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.0004335871 7.605182e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.3188805866 1.087735e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.3309078938 1.060911e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.5028006131 1.160011e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.6528572694 1.186580e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.8718257655 1.364287e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.2520899171 1.805404e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.0074017452 1.497857e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.0603097543 5.803852e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.0928555300 6.711811e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.2988023303 1.058464e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.1076273529 8.552033e-01
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.2767057205 9.252172e-01
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.4865603035 1.002139e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.8054817850 1.277004e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.2695292674 1.780061e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.0151123759 1.514793e+00
## s(Time_Period_ID):as.factor(Region)South.1 0.0570740955 7.495178e-01
## s(Time_Period_ID):as.factor(Region)South.2 0.1381381882 9.312519e-01
## s(Time_Period_ID):as.factor(Region)South.3 0.3100520401 1.203238e+00
## s(Time_Period_ID):as.factor(Region)South.4 0.3398378244 1.186237e+00
## s(Time_Period_ID):as.factor(Region)South.5 0.4794088299 1.163686e+00
## s(Time_Period_ID):as.factor(Region)South.6 0.4731169245 1.015187e+00
## s(Time_Period_ID):as.factor(Region)South.7 0.6952043414 1.175043e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.0252656894 1.434572e+00
## s(Time_Period_ID):as.factor(Region)South.9 0.8214848686 1.275874e+00
## s(Time_Period_ID):as.factor(Region)West.1 0.1314639265 7.053735e-01
## s(Time_Period_ID):as.factor(Region)West.2 0.2138460907 9.364172e-01
## s(Time_Period_ID):as.factor(Region)West.3 0.2941530342 1.054541e+00
## s(Time_Period_ID):as.factor(Region)West.4 0.3481965032 1.105399e+00
## s(Time_Period_ID):as.factor(Region)West.5 0.3572763818 9.902903e-01
## s(Time_Period_ID):as.factor(Region)West.6 0.3935584326 9.051350e-01
## s(Time_Period_ID):as.factor(Region)West.7 0.4739299570 9.150746e-01
## s(Time_Period_ID):as.factor(Region)West.8 0.6519839172 9.580594e-01
## s(Time_Period_ID):as.factor(Region)West.9 0.7161845430 1.138512e+00
## exp_coef exp_ub
## (Intercept) 4.924793e-05 6.830337e-05
## StateArizona 1.372626e+00 1.472451e+00
## StateArkansas 6.783547e-01 7.420274e-01
## StateCalifornia 8.513837e-01 9.237720e-01
## StateColorado 1.104418e+00 1.199920e+00
## StateConnecticut 1.203364e+00 1.306046e+00
## StateDelaware 1.542105e+00 1.755288e+00
## StateFlorida 1.287203e+00 1.386631e+00
## StateGeorgia 9.312867e-01 9.940164e-01
## StateHawaii 8.007562e-01 8.874102e-01
## StateIdaho 8.734861e-01 9.528920e-01
## StateIllinois 9.827994e-01 1.071055e+00
## StateIndiana 1.091084e+00 1.170344e+00
## StateIowa 4.766268e-01 5.189977e-01
## StateKansas 7.204059e-01 7.940226e-01
## StateKentucky 1.898361e+00 2.039233e+00
## StateLouisiana 1.341248e+00 1.440880e+00
## StateMaine 1.156934e+00 1.273895e+00
## StateMaryland 3.442843e-01 4.269207e-01
## StateMassachusetts 1.229736e+00 1.363820e+00
## StateMichigan 9.800396e-01 1.052427e+00
## StateMinnesota 5.393136e-01 5.854404e-01
## StateMississippi 9.063542e-01 9.838125e-01
## StateMissouri 1.216673e+00 1.312346e+00
## StateNevada 1.553311e+00 1.691560e+00
## StateNew Hampshire 1.294264e+00 1.411822e+00
## StateNew Jersey 1.112264e+00 1.226729e+00
## StateNew Mexico 1.873945e+00 2.045136e+00
## StateNew York 7.849902e-01 8.444775e-01
## StateNorth Carolina 1.192516e+00 1.273075e+00
## StateOhio 1.573276e+00 1.706139e+00
## StateOklahoma 1.469758e+00 1.626561e+00
## StateOregon 8.260371e-01 9.000792e-01
## StatePennsylvania 1.542754e+00 1.653368e+00
## StateRhode Island 1.268396e+00 1.429537e+00
## StateSouth Carolina 1.249855e+00 1.335352e+00
## StateTennessee 1.546457e+00 1.652162e+00
## StateTexas 8.143057e-01 8.764416e-01
## StateUtah 1.073165e+00 1.227408e+00
## StateVirginia 8.920634e-01 9.654090e-01
## StateWashington 1.082170e+00 1.184458e+00
## StateWest Virginia 2.403849e+00 2.644346e+00
## StateWisconsin 9.624753e-01 1.026089e+00
## Naloxone_Pharmacy_Yes_Redefined 9.791249e-01 1.031945e+00
## Naloxone_Pharmacy_No_Redefined 1.016626e+00 1.056854e+00
## Medical_Marijuana_Redefined 1.063348e+00 1.112598e+00
## Recreational_Marijuana_Redefined 9.608098e-01 1.009078e+00
## GSL_Redefined 1.034131e+00 1.080698e+00
## PDMP_Redefined 9.839862e-01 1.025084e+00
## Medicaid_Expansion_Redefined 1.103899e+00 1.142545e+00
## Intervention_Redefined 1.068037e+00 1.107449e+00
## num_states_w_intervention 1.003775e+00 1.015017e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 7.255973e-01 9.161817e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 8.722660e-01 1.000434e+00
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.223223e+00 1.375587e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.215333e+00 1.392232e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.384882e+00 1.653345e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.509784e+00 1.921022e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.806207e+00 2.391273e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.512899e+00 3.497645e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.025302e+00 2.738477e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 7.392002e-01 9.414729e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 7.820897e-01 9.113251e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.194599e+00 1.348243e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 9.759008e-01 1.113633e+00
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.104607e+00 1.318778e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.276789e+00 1.626711e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.690458e+00 2.237774e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 2.517052e+00 3.559177e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.044586e+00 2.759674e+00
## s(Time_Period_ID):as.factor(Region)South.1 8.908087e-01 1.058734e+00
## s(Time_Period_ID):as.factor(Region)South.2 1.034022e+00 1.148134e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.280863e+00 1.363496e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.290864e+00 1.404720e+00
## s(Time_Period_ID):as.factor(Region)South.5 1.370946e+00 1.615119e+00
## s(Time_Period_ID):as.factor(Region)South.6 1.276466e+00 1.604989e+00
## s(Time_Period_ID):as.factor(Region)South.7 1.534577e+00 2.004119e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.999838e+00 2.787836e+00
## s(Time_Period_ID):as.factor(Region)South.9 1.703284e+00 2.273874e+00
## s(Time_Period_ID):as.factor(Region)West.1 8.969259e-01 1.140497e+00
## s(Time_Period_ID):as.factor(Region)West.2 1.076889e+00 1.238432e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.189615e+00 1.341989e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.251323e+00 1.416511e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.189770e+00 1.429431e+00
## s(Time_Period_ID):as.factor(Region)West.6 1.158289e+00 1.482246e+00
## s(Time_Period_ID):as.factor(Region)West.7 1.212386e+00 1.606294e+00
## s(Time_Period_ID):as.factor(Region)West.8 1.356041e+00 1.919345e+00
## s(Time_Period_ID):as.factor(Region)West.9 1.526463e+00 2.046610e+00
## sd_coef
## (Intercept) 0.16688359
## StateArizona 0.03581753
## StateArkansas 0.04577342
## StateCalifornia 0.04163388
## StateColorado 0.04231473
## StateConnecticut 0.04177719
## StateDelaware 0.06606370
## StateFlorida 0.03796189
## StateGeorgia 0.03325847
## StateHawaii 0.05242389
## StateIdaho 0.04439252
## StateIllinois 0.04387486
## StateIndiana 0.03577860
## StateIowa 0.04345182
## StateKansas 0.04964145
## StateKentucky 0.03652175
## StateLouisiana 0.03655772
## StateMaine 0.04913564
## StateMaryland 0.10976046
## StateMassachusetts 0.05280104
## StateMichigan 0.03635775
## StateMinnesota 0.04187097
## StateMississippi 0.04183931
## StateMissouri 0.03862057
## StateNevada 0.04350135
## StateNew Hampshire 0.04435686
## StateNew Jersey 0.04997645
## StateNew Mexico 0.04460129
## StateNew York 0.03726883
## StateNorth Carolina 0.03335192
## StateOhio 0.04136369
## StateOklahoma 0.05171965
## StateOregon 0.04379747
## StatePennsylvania 0.03532942
## StateRhode Island 0.06101903
## StateSouth Carolina 0.03375899
## StateTennessee 0.03373384
## StateTexas 0.03751745
## StateUtah 0.06851658
## StateVirginia 0.04031355
## StateWashington 0.04608025
## StateWest Virginia 0.04864925
## StateWisconsin 0.03265400
## Naloxone_Pharmacy_Yes_Redefined 0.02680688
## Naloxone_Pharmacy_No_Redefined 0.01979967
## Medical_Marijuana_Redefined 0.02309973
## Recreational_Marijuana_Redefined 0.02500814
## GSL_Redefined 0.02247220
## PDMP_Redefined 0.02087631
## Medicaid_Expansion_Redefined 0.01755596
## Intervention_Redefined 0.01848809
## num_states_w_intervention 0.00568220
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.11898960
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.06994614
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.05989363
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.06933153
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.09040070
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.12290353
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.14316164
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.16870043
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.15391996
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.12340649
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.07802569
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.06173054
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.06735801
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.09041644
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.12357737
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.14310333
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.17675554
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.15301880
## s(Time_Period_ID):as.factor(Region)South.1 0.08811207
## s(Time_Period_ID):as.factor(Region)South.2 0.05340911
## s(Time_Period_ID):as.factor(Region)South.3 0.03189683
## s(Time_Period_ID):as.factor(Region)South.4 0.04312540
## s(Time_Period_ID):as.factor(Region)South.5 0.08362653
## s(Time_Period_ID):as.factor(Region)South.6 0.11684792
## s(Time_Period_ID):as.factor(Region)South.7 0.13619884
## s(Time_Period_ID):as.factor(Region)South.8 0.16948959
## s(Time_Period_ID):as.factor(Region)South.9 0.14741164
## s(Time_Period_ID):as.factor(Region)West.1 0.12257444
## s(Time_Period_ID):as.factor(Region)West.2 0.07131128
## s(Time_Period_ID):as.factor(Region)West.3 0.06149162
## s(Time_Period_ID):as.factor(Region)West.4 0.06326289
## s(Time_Period_ID):as.factor(Region)West.5 0.09363099
## s(Time_Period_ID):as.factor(Region)West.6 0.12582387
## s(Time_Period_ID):as.factor(Region)West.7 0.14354072
## s(Time_Period_ID):as.factor(Region)West.8 0.17725241
## s(Time_Period_ID):as.factor(Region)West.9 0.14960778
Compile Results
############################## Make Data Frame of Results and 95% CI ###############################
#store the coefficients into the table
sensitivity_anlys_exclude_states_full_table<-sensitivity_anlys_exclude_states_sd_and_ci
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"Intervention_Redefined",
"num_states_w_intervention")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_exclude_states_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_exclude_states_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(sensitivity_anlys_exclude_states_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_exclude_states_full_table)[i]<-substr(rownames(sensitivity_anlys_exclude_states_full_table)[i],
start = 6,
stop = nchar(rownames(sensitivity_anlys_exclude_states_full_table)[i]))
}else if(rownames(sensitivity_anlys_exclude_states_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_exclude_states_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_exclude_states_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_exclude_states_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_exclude_states_full_table)[i],
start = 36,
stop = nchar(rownames(sensitivity_anlys_exclude_states_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_exclude_states_full_table)
## lb_coef coef_values ub_coef exp_lb
## Intercept/Alabama -10.24573509 -9.91864326 -9.59155143 3.550862e-05
## Arizona 0.24652335 0.31672571 0.38692807 1.279569e+00
## Arkansas -0.47780087 -0.38808496 -0.29836905 6.201457e-01
## California -0.24249477 -0.16089236 -0.07928995 7.846679e-01
## Colorado 0.01638143 0.09931829 0.18225515 1.016516e+00
## Connecticut 0.10323736 0.18512065 0.26700394 1.108755e+00
## exp_coef exp_ub sd_coef
## Intercept/Alabama 4.924793e-05 6.830337e-05 0.16688359
## Arizona 1.372626e+00 1.472451e+00 0.03581753
## Arkansas 6.783547e-01 7.420274e-01 0.04577342
## California 8.513837e-01 9.237720e-01 0.04163388
## Colorado 1.104418e+00 1.199920e+00 0.04231473
## Connecticut 1.203364e+00 1.306046e+00 0.04177719
tail(sensitivity_anlys_exclude_states_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.100205972 0.2242012 0.3481965 1.1053986
## Smoothed Time for Region West.5 -0.009757108 0.1737596 0.3572764 0.9902903
## Smoothed Time for Region West.6 -0.099671123 0.1469437 0.3935584 0.9051350
## Smoothed Time for Region West.7 -0.088749672 0.1925901 0.4739300 0.9150746
## Smoothed Time for Region West.8 -0.042845526 0.3045692 0.6519839 0.9580594
## Smoothed Time for Region West.9 0.129722049 0.4229533 0.7161845 1.1385119
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.251323 1.416511 0.06326289
## Smoothed Time for Region West.5 1.189770 1.429431 0.09363099
## Smoothed Time for Region West.6 1.158289 1.482246 0.12582387
## Smoothed Time for Region West.7 1.212386 1.606294 0.14354072
## Smoothed Time for Region West.8 1.356041 1.919345 0.17725241
## Smoothed Time for Region West.9 1.526463 2.046610 0.14960778
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(sensitivity_anlys_exclude_states_full_table) %in% covariates)
sensitivity_anlys_exclude_states_covariate_table<-(round(sensitivity_anlys_exclude_states_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(sensitivity_anlys_exclude_states_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Intervention_Redefined",
"Number of States w DIH Prosecution")
#now, reorganize the data so that the covariates are on top and the rest of the variables are below
sensitivity_anlys_exclude_states_covariate_table<-rbind(sensitivity_anlys_exclude_states_covariate_table,
sensitivity_anlys_exclude_states_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
sensitivity_anlys_exclude_states_covariate_table<-sensitivity_anlys_exclude_states_covariate_table[,
-which(colnames(sensitivity_anlys_exclude_states_covariate_table) %in%
c("lb_coef", "coef_values", "ub_coef"))]
colnames(sensitivity_anlys_exclude_states_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(sensitivity_anlys_exclude_states_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates
## Naloxone_Pharmacy_Yes 9.290100e-01 9.791200e-01
## Naloxone_Pharmacy_No 9.779300e-01 1.016630e+00
## Medical_Marijuana 1.016280e+00 1.063350e+00
## Recreational_Marijuana 9.148500e-01 9.608100e-01
## GSL 9.895700e-01 1.034130e+00
## PDMP 9.445400e-01 9.839900e-01
## Medicaid_Expansion 1.066560e+00 1.103900e+00
## Intervention_Redefined 1.030030e+00 1.068040e+00
## Number of States w DIH Prosecution 9.926600e-01 1.003780e+00
## Intercept/Alabama 3.550862e-05 4.924793e-05
## RR_95_CI_UB standard_error
## Naloxone_Pharmacy_Yes 1.031950e+00 0.0268100
## Naloxone_Pharmacy_No 1.056850e+00 0.0198000
## Medical_Marijuana 1.112600e+00 0.0231000
## Recreational_Marijuana 1.009080e+00 0.0250100
## GSL 1.080700e+00 0.0224700
## PDMP 1.025080e+00 0.0208800
## Medicaid_Expansion 1.142540e+00 0.0175600
## Intervention_Redefined 1.107450e+00 0.0184900
## Number of States w DIH Prosecution 1.015020e+00 0.0056800
## Intercept/Alabama 6.830337e-05 0.1668836
#save the table into a CSV
# write.csv(round(sensitivity_anlys_exclude_states_covariate_table, 3), "./Data/coefficients_covariates_1_18_22_full_data_exclude_states.csv")
Attributable Deaths
###################################### Attributable Deaths #############################
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_exclude_states<-sensitivity_anlys_exclude_states_data[
which(sensitivity_anlys_exclude_states_data$Intervention_Redefined>0),]
#compute the probability of overdose had intervention not occurred
prob_od_no_int_exclude_states<-expit(-coef(sensitivity_anlys_exclude_states_model)["Intervention_Redefined"]*
attr_deaths_anlys_exclude_states$Intervention_Redefined
+ logit(attr_deaths_anlys_exclude_states$imputed_deaths/attr_deaths_anlys_exclude_states$population))
#compute the lower and upper bounds of 95% CI of probability of overdose had intervention not occurred
#here, we compute the lower and upper bounds of the 95% CI of all the coefficients using the standard error from the model
coef_lb<-sensitivity_anlys_exclude_states_full_table$lb_coef
coef_ub<-sensitivity_anlys_exclude_states_full_table$ub_coef
names(coef_lb) <- names(coef_ub) <- rownames(sensitivity_anlys_exclude_states_full_table)
#we then calculate the upper and lower bounds of the probability of overdose death had intervention not occurred by using
#the lower and upper bounds of the coefficient of the intervention variable
prob_od_no_int_LB_exclude_states<-expit(-coef_lb[names(coef_lb) == "Intervention_Redefined"]*
attr_deaths_anlys_exclude_states$Intervention_Redefined
+ logit(attr_deaths_anlys_exclude_states$imputed_deaths/
attr_deaths_anlys_exclude_states$population))
prob_od_no_int_UB_exclude_states<-expit(-coef_ub[names(coef_ub) == "Intervention_Redefined"]*
attr_deaths_anlys_exclude_states$Intervention_Redefined
+ logit(attr_deaths_anlys_exclude_states$imputed_deaths/
attr_deaths_anlys_exclude_states$population))
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(sensitivity_anlys_exclude_states_data$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths that attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_exclude_states$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_exclude_states$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_exclude_states$imputed_deaths[time_point_index]
- prob_od_no_int_exclude_states[time_point_index]*attr_deaths_anlys_exclude_states$population[time_point_index])
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-sum(attr_deaths_anlys_exclude_states$imputed_deaths[time_point_index]
- prob_od_no_int_LB_exclude_states[time_point_index]*
attr_deaths_anlys_exclude_states$population[time_point_index])
num_attr_od_UB[index]<-sum(attr_deaths_anlys_exclude_states$imputed_deaths[time_point_index]
- prob_od_no_int_UB_exclude_states[time_point_index]*
attr_deaths_anlys_exclude_states$population[time_point_index])
index<-index + 1
}
num_attr_od_exclude_states<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_exclude_states$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_exclude_states$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_exclude_states$Num_Attr_Deaths)
## [1] 34907.92
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_exclude_states<-num_attr_od_exclude_states %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths), death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_exclude_states$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 31.69 797.13 1488.48 1745.40 2428.27 3873.37
Sensitivity Analysis 3: Divide Unintentional Deaths Equally Amongst Missing Months
Analysis
### Sensitivity Analysis 3: Divide Unaccountable Deaths Equally Among Missing Months #####
od_data <- read.csv("./Data/unintentional_od_1999_2019_age_17_up.txt", sep = "\t", stringsAsFactors = FALSE)
od_data$Deaths <- as.numeric(od_data$Deaths)
od_data<-od_data[!is.na(od_data$Year),] #delete the rows that just contains data set description info
tail(od_data)
## Notes State State.Code Year Year.Code Month Month.Code Deaths
## 12595 Wyoming 56 2019 2019 Jul., 2019 2019/07 NA
## 12596 Wyoming 56 2019 2019 Aug., 2019 2019/08 NA
## 12597 Wyoming 56 2019 2019 Sep., 2019 2019/09 NA
## 12598 Wyoming 56 2019 2019 Oct., 2019 2019/10 NA
## 12599 Wyoming 56 2019 2019 Nov., 2019 2019/11 NA
## 12600 Wyoming 56 2019 2019 Dec., 2019 2019/12 NA
## Population Crude.Rate
## 12595 Not Applicable Not Applicable
## 12596 Not Applicable Not Applicable
## 12597 Not Applicable Not Applicable
## 12598 Not Applicable Not Applicable
## 12599 Not Applicable Not Applicable
## 12600 Not Applicable Not Applicable
sum(is.na(od_data$Deaths))
## [1] 3148
#set up the overdose data to impute the missing data
#set up the dates
od_data$Date<-mdy(od_data$Month)
length(unique(od_data$State))
## [1] 50
#DC is being counted in this, but we do not have data on prosecutions. Remove these rows
od_data<-od_data[od_data$State!="District of Columbia",]
#interpolate the missing values
od_year <- read.csv("./Data/unintentional_od_yearly_1999_2019_age_17_up.txt", sep = "\t", stringsAsFactors = FALSE)
od_year$Deaths <- as.numeric(od_year$Deaths)
head(od_year, 50)
## Notes State State.Code Year Year.Code Deaths Population Crude.Rate
## 1 Alabama 1 1999 1999 115 3308855 3.5
## 2 Alabama 1 2000 2000 126 3323678 3.8
## 3 Alabama 1 2001 2001 163 3347225 4.9
## 4 Alabama 1 2002 2002 167 3363499 5.0
## 5 Alabama 1 2003 2003 150 3390408 4.4
## 6 Alabama 1 2004 2004 220 3417067 6.4
## 7 Alabama 1 2005 2005 215 3452576 6.2
## 8 Alabama 1 2006 2006 308 3502183 8.8
## 9 Alabama 1 2007 2007 416 3540544 11.7
## 10 Alabama 1 2008 2008 482 3583279 13.5
## 11 Alabama 1 2009 2009 535 3623746 14.8
## 12 Alabama 1 2010 2010 462 3647277 12.7
## 13 Alabama 1 2011 2011 484 3675597 13.2
## 14 Alabama 1 2012 2012 473 3697617 12.8
## 15 Alabama 1 2013 2013 520 3722241 14.0
## 16 Alabama 1 2014 2014 637 3741806 17.0
## 17 Alabama 1 2015 2015 653 3755483 17.4
## 18 Alabama 1 2016 2016 680 3766477 18.1
## 19 Alabama 1 2017 2017 750 3779274 19.8
## 20 Alabama 1 2018 2018 683 3798031 18.0
## 21 Alabama 1 2019 2019 695 3814879 18.2
## 22 Total Alabama 1 NA NA 8934 75251742 11.9
## 23 Alaska 2 1999 1999 27 433357 6.2
## 24 Alaska 2 2000 2000 35 436215 8.0
## 25 Alaska 2 2001 2001 52 444943 11.7
## 26 Alaska 2 2002 2002 69 453855 15.2
## 27 Alaska 2 2003 2003 69 461571 14.9
## 28 Alaska 2 2004 2004 62 472951 13.1
## 29 Alaska 2 2005 2005 61 481642 12.7
## 30 Alaska 2 2006 2006 66 489722 13.5
## 31 Alaska 2 2007 2007 63 495956 12.7
## 32 Alaska 2 2008 2008 88 504331 17.4
## 33 Alaska 2 2009 2009 99 512544 19.3
## 34 Alaska 2 2010 2010 74 522853 14.2
## 35 Alaska 2 2011 2011 94 534277 17.6
## 36 Alaska 2 2012 2012 112 544349 20.6
## 37 Alaska 2 2013 2013 92 547000 16.8
## 38 Alaska 2 2014 2014 103 550189 18.7
## 39 Alaska 2 2015 2015 105 552166 19.0
## 40 Alaska 2 2016 2016 102 554567 18.4
## 41 Alaska 2 2017 2017 123 554867 22.2
## 42 Alaska 2 2018 2018 94 553622 17.0
## 43 Alaska 2 2019 2019 112 551562 20.3
## 44 Total Alaska 2 NA NA 1702 10652539 16.0
## 45 Arizona 4 1999 1999 360 3691428 9.8
## 46 Arizona 4 2000 2000 397 3763685 10.5
## 47 Arizona 4 2001 2001 418 3874462 10.8
## 48 Arizona 4 2002 2002 457 3968317 11.5
## 49 Arizona 4 2003 2003 507 4056693 12.5
## 50 Arizona 4 2004 2004 537 4167950 12.9
#see how many states have missing yearly entries and use the totals to impute the missing yearly values.
sum_na <- od_year %>% group_by(State) %>% summarise(sum(is.na(Deaths)))
table(sum_na)
## sum(is.na(Deaths))
## State 0 4 5 72
## 0 0 0 1
## Alabama 1 0 0 0
## Alaska 1 0 0 0
## Arizona 1 0 0 0
## Arkansas 1 0 0 0
## California 1 0 0 0
## Colorado 1 0 0 0
## Connecticut 1 0 0 0
## Delaware 1 0 0 0
## Florida 1 0 0 0
## Georgia 1 0 0 0
## Hawaii 1 0 0 0
## Idaho 1 0 0 0
## Illinois 1 0 0 0
## Indiana 1 0 0 0
## Iowa 1 0 0 0
## Kansas 1 0 0 0
## Kentucky 1 0 0 0
## Louisiana 1 0 0 0
## Maine 1 0 0 0
## Maryland 1 0 0 0
## Massachusetts 1 0 0 0
## Michigan 1 0 0 0
## Minnesota 1 0 0 0
## Mississippi 1 0 0 0
## Missouri 1 0 0 0
## Montana 1 0 0 0
## Nebraska 1 0 0 0
## Nevada 1 0 0 0
## New Hampshire 1 0 0 0
## New Jersey 1 0 0 0
## New Mexico 1 0 0 0
## New York 1 0 0 0
## North Carolina 1 0 0 0
## North Dakota 0 1 0 0
## Ohio 1 0 0 0
## Oklahoma 1 0 0 0
## Oregon 1 0 0 0
## Pennsylvania 1 0 0 0
## Rhode Island 0 1 0 0
## South Carolina 1 0 0 0
## South Dakota 0 0 1 0
## Tennessee 1 0 0 0
## Texas 1 0 0 0
## Utah 1 0 0 0
## Vermont 1 0 0 0
## Virginia 1 0 0 0
## Washington 1 0 0 0
## West Virginia 1 0 0 0
## Wisconsin 1 0 0 0
## Wyoming 1 0 0 0
#the 3 states are: North Dakota, South Dakota, and Rhode Island
od_year$Deaths[od_year$State == "North Dakota" & is.na(od_year$Deaths)] <- (od_year$Deaths[od_year$State == "North Dakota" &
od_year$Notes == "Total"] -
sum(od_year$Deaths[od_year$State == "North Dakota" &
od_year$Notes != "Total"],
na.rm = TRUE))/sum(is.na(od_year$Deaths[od_year$State ==
"North Dakota"]))
od_year$Deaths[od_year$State == "South Dakota" & is.na(od_year$Deaths)] <- (od_year$Deaths[od_year$State == "South Dakota" &
od_year$Notes == "Total"] -
sum(od_year$Deaths[od_year$State == "South Dakota" &
od_year$Notes != "Total"],
na.rm = TRUE))/sum(is.na(od_year$Deaths[od_year$State ==
"South Dakota"]))
od_year$Deaths[od_year$State == "Rhode Island" & is.na(od_year$Deaths)] <- (od_year$Deaths[od_year$State == "Rhode Island" &
od_year$Notes == "Total"] -
sum(od_year$Deaths[od_year$State == "Rhode Island" &
od_year$Notes != "Total"],
na.rm = TRUE))/sum(is.na(od_year$Deaths[od_year$State ==
"Rhode Island"]))
od_year <- od_year[!is.na(od_year$Year),]
tail(od_year)
## Notes State State.Code Year Year.Code Deaths Population Crude.Rate
## 1094 Wyoming 56 2014 2014 87 445830 19.5
## 1095 Wyoming 56 2015 2015 79 447212 17.7
## 1096 Wyoming 56 2016 2016 79 446600 17.7
## 1097 Wyoming 56 2017 2017 53 442832 12.0
## 1098 Wyoming 56 2018 2018 54 442962 12.2
## 1099 Wyoming 56 2019 2019 68 445025 15.3
od_data$imputed_vals<-rep(NA, nrow(od_data))
startYear<-1999
for(state in unique(od_data$State)){
#get the values of the deaths for state
currentDeaths<-od_data$Deaths[od_data$State == state]
for(year in startYear:2019){
#find the indices of the missing data -- gets the missing indices for that particular year
indexMissing <- which(is.na(currentDeaths[(1:12) + 12*(year - startYear)]))
if(length(indexMissing) != 0){
#if there are missing values, we find the number of accounted deaths
currentDeathsTotal <- sum(currentDeaths[(1:12) + 12*(year - startYear)], na.rm = TRUE)
#and calculate the deaths that are not accounted for using the yearly deaths for the state
numNotAccounted <- od_year$Deaths[od_year$State == state & od_year$Year == year] - currentDeathsTotal
#we then divide number of unaccounted deaths evenly by the number of months with missing values
currentDeaths[(1:12) + 12*(year - startYear)][indexMissing] <- numNotAccounted/length(indexMissing)
}else{
#otherwise, if there is no missing values, we skip to the next year
next
}
}
#store the imputed values
od_data$imputed_vals[od_data$State == state]<-currentDeaths
}
#group into 6 month time periods now and compute the total number of deaths in each period
od_data_grouped_data <- od_data %>%
mutate(Time_Period_Start = lubridate::floor_date(Date , "6 months" )) %>%
group_by(State, Time_Period_Start) %>%
summarise(sum_deaths = sum(imputed_vals, na.rm = TRUE))
#restrict the dataset to be between 2000 and 2017
od_data_grouped_data <- od_data_grouped_data[year(od_data_grouped_data$Time_Period_Start) > 1999 &
year(od_data_grouped_data$Time_Period_Start) < 2020,]
#create a new dataset for the analysis using columns from the main analysis data
sensitivity_anlys_imputed_od_wo_interp_data <- main_analysis_data %>%
ungroup() %>%
mutate(imputed_deaths_no_interp = od_data_grouped_data$sum_deaths,
num_alive_no_interp = population - imputed_deaths_no_interp) %>%
dplyr::select(-c(imputed_deaths, num_alive)) #want to remove the outcome from main analysis to not get confused
#compute the number of states with intervention
sensitivity_anlys_imputed_od_wo_interp_data <- sensitivity_anlys_imputed_od_wo_interp_data %>%
group_by(Time_Period_Start) %>%
mutate(num_states_with_intervention = sum(Intervention_Redefined))
#run the model for analysis
sensitivity_anlys_imputed_od_wo_interp <- gam(cbind(round(imputed_deaths_no_interp),
round(num_alive_no_interp))~ State +
s(Time_Period_ID, bs = "cr",
by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
Intervention_Redefined +
num_states_w_intervention,
data = sensitivity_anlys_imputed_od_wo_interp_data,
family = "binomial")
stargazer(sensitivity_anlys_imputed_od_wo_interp, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.277***
|
|
|
(0.028)
|
|
|
|
|
StateArizona
|
0.315***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.390***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.159***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.097***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.189***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.430***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.253***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.071***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.226***
|
|
|
(0.026)
|
|
|
|
|
StateIdaho
|
-0.136***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.016
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.088***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.740***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.328***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.641***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.294***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.145***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.066***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.208***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.019
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.618***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.100***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.194***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.360***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.883***
|
|
|
(0.029)
|
|
|
|
|
StateNevada
|
0.439***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.258***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.107***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.631***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.238***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.177***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.053***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.455***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.385***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.194***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.436***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.238***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.221***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-0.941***
|
|
|
(0.042)
|
|
|
|
|
StateTennessee
|
0.436***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.204***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.072***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.167***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.113***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.078***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.876***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.037**
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.024
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.024***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.009
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.063***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.037***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.034***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.019***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.099***
|
|
|
(0.006)
|
|
|
|
|
Intervention_Redefined
|
0.062***
|
|
|
(0.005)
|
|
|
|
|
num_states_w_intervention
|
0.004**
|
|
|
(0.002)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.911***
|
|
|
(0.054)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.911
|
|
Log Likelihood
|
-16,741.690
|
|
UBRE
|
8.831
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
# exp(coef(sensitivity_anlys_imputed_od_wo_interp)["Intervention_Redefined"])
Sandwich Estimator
#compute the full dataset including basis functions
sensitivity_anlys_imputed_od_wo_interp_w_basis_functions <- data.frame(predict(sensitivity_anlys_imputed_od_wo_interp, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_imputed_od_wo_interp_coefficient_values <- coef(sensitivity_anlys_imputed_od_wo_interp)
#type = "response" to get the estimated probabilities
sensitivity_anlys_imputed_od_wo_interp_pred_prob <- predict(sensitivity_anlys_imputed_od_wo_interp,
newdata = sensitivity_anlys_imputed_od_wo_interp_data, type = "response")
sensitivity_anlys_imputed_od_wo_interp_sd_and_ci <- compute_sd_and_CI(sensitivity_anlys_imputed_od_wo_interp_w_basis_functions,
sensitivity_anlys_imputed_od_wo_interp_data$population,
sensitivity_anlys_imputed_od_wo_interp_data$imputed_deaths_no_interp,
sensitivity_anlys_imputed_od_wo_interp_pred_prob,
sensitivity_anlys_imputed_od_wo_interp_coefficient_values)
sensitivity_anlys_imputed_od_wo_interp_sd_and_ci
## lb_coef coef_values
## (Intercept) -10.234586133 -9.910975285
## StateAlaska 0.177220967 0.277493219
## StateArizona 0.244505289 0.314816835
## StateArkansas -0.479472205 -0.389941327
## StateCalifornia -0.240109266 -0.158892696
## StateColorado 0.014547257 0.096727398
## StateConnecticut 0.107873194 0.189267741
## StateDelaware 0.300181838 0.429995117
## StateFlorida 0.178439645 0.252768857
## StateGeorgia -0.136052986 -0.070932534
## StateHawaii -0.327798784 -0.225848082
## StateIdaho -0.222594886 -0.136010205
## StateIllinois -0.101610654 -0.015708525
## StateIndiana 0.017868194 0.087867596
## StateIowa -0.824692179 -0.740230397
## StateKansas -0.425014297 -0.328390847
## StateKentucky 0.569681262 0.641135719
## StateLouisiana 0.222314989 0.293953701
## StateMaine 0.049934832 0.145424087
## StateMaryland -1.281393750 -1.066370008
## StateMassachusetts 0.104571280 0.207751518
## StateMichigan -0.090368299 -0.019210604
## StateMinnesota -0.699646010 -0.618140729
## StateMississippi -0.181187313 -0.099501205
## StateMissouri 0.118459376 0.193779688
## StateMontana -0.447797614 -0.359994560
## StateNebraska -0.980522841 -0.882843763
## StateNevada 0.354680868 0.439237933
## StateNew Hampshire 0.170730569 0.257514005
## StateNew Jersey 0.009539894 0.107374278
## StateNew Mexico 0.543750668 0.631110734
## StateNew York -0.311546501 -0.238439930
## StateNorth Carolina 0.111511898 0.176853775
## StateNorth Dakota -1.171261509 -1.052650406
## StateOhio 0.373675218 0.454839339
## StateOklahoma 0.283915782 0.385313433
## StateOregon -0.278787562 -0.193966900
## StatePennsylvania 0.366487656 0.435630876
## StateRhode Island 0.119477435 0.238179960
## StateSouth Carolina 0.155256915 0.221492017
## StateSouth Dakota -1.044689317 -0.941378412
## StateTennessee 0.370221952 0.436410606
## StateTexas -0.277711557 -0.204009701
## StateUtah -0.061948454 0.072121167
## StateVermont -0.261773612 -0.167237693
## StateVirginia -0.191408342 -0.112537349
## StateWashington -0.011530865 0.077891360
## StateWest Virginia 0.781179575 0.876426372
## StateWisconsin -0.101305367 -0.037367309
## StateWyoming -0.086749853 0.024169082
## Naloxone_Pharmacy_Yes_Redefined -0.075558077 -0.023963799
## Naloxone_Pharmacy_No_Redefined -0.029720087 0.008540788
## Medical_Marijuana_Redefined 0.018040452 0.062812046
## Recreational_Marijuana_Redefined -0.084809384 -0.036999466
## GSL_Redefined -0.009601441 0.033924631
## PDMP_Redefined -0.059580977 -0.019415988
## Medicaid_Expansion_Redefined 0.065172142 0.098890777
## Intervention_Redefined 0.026516858 0.062018603
## num_states_w_intervention -0.007324551 0.003693446
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.557290367 -0.327440060
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.274899379 -0.139979319
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.082724763 0.197908593
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.067060596 0.200653126
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.154500598 0.329438011
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.178140324 0.416329310
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.320260506 0.597544608
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.596528510 0.923084136
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.411151047 0.709057894
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.540616334 -0.301638789
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.396024641 -0.244584656
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.059001022 0.178828068
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.150224545 -0.019551348
## s(Time_Period_ID):as.factor(Region)Northeast.5 -0.072326371 0.103140559
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.009872608 0.249601600
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.250719336 0.528068064
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.584273824 0.926794211
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.421757678 0.718321256
## s(Time_Period_ID):as.factor(Region)South.1 -0.289833404 -0.118307046
## s(Time_Period_ID):as.factor(Region)South.2 -0.072043606 0.031852790
## s(Time_Period_ID):as.factor(Region)South.3 0.185055516 0.247534941
## s(Time_Period_ID):as.factor(Region)South.4 0.172307634 0.256322289
## s(Time_Period_ID):as.factor(Region)South.5 0.155899047 0.318213658
## s(Time_Period_ID):as.factor(Region)South.6 0.021124387 0.247869010
## s(Time_Period_ID):as.factor(Region)South.7 0.170828893 0.434907176
## s(Time_Period_ID):as.factor(Region)South.8 0.371639510 0.700277327
## s(Time_Period_ID):as.factor(Region)South.9 0.252325067 0.538263397
## s(Time_Period_ID):as.factor(Region)West.1 -0.345401065 -0.108676981
## s(Time_Period_ID):as.factor(Region)West.2 -0.065939353 0.071317793
## s(Time_Period_ID):as.factor(Region)West.3 0.052051947 0.170549863
## s(Time_Period_ID):as.factor(Region)West.4 0.113320726 0.235107628
## s(Time_Period_ID):as.factor(Region)West.5 0.002245659 0.183412585
## s(Time_Period_ID):as.factor(Region)West.6 -0.082698326 0.161004596
## s(Time_Period_ID):as.factor(Region)West.7 -0.074158982 0.203627896
## s(Time_Period_ID):as.factor(Region)West.8 -0.034778609 0.308296237
## s(Time_Period_ID):as.factor(Region)West.9 0.132930305 0.422461307
## ub_coef exp_lb
## (Intercept) -9.587364437 3.590672e-05
## StateAlaska 0.377765472 1.193895e+00
## StateArizona 0.385128380 1.276989e+00
## StateArkansas -0.300410449 6.191101e-01
## StateCalifornia -0.077676127 7.865419e-01
## StateColorado 0.178907538 1.014654e+00
## StateConnecticut 0.270662287 1.113906e+00
## StateDelaware 0.559808397 1.350104e+00
## StateFlorida 0.327098068 1.195351e+00
## StateGeorgia -0.005812082 8.727964e-01
## StateHawaii -0.123897379 7.205080e-01
## StateIdaho -0.049425525 8.004391e-01
## StateIllinois 0.070193603 9.033812e-01
## StateIndiana 0.157866997 1.018029e+00
## StateIowa -0.655768614 4.383699e-01
## StateKansas -0.231767397 6.537604e-01
## StateKentucky 0.712590176 1.767704e+00
## StateLouisiana 0.365592413 1.248965e+00
## StateMaine 0.240913341 1.051203e+00
## StateMaryland -0.851346267 2.776501e-01
## StateMassachusetts 0.310931756 1.110235e+00
## StateMichigan 0.051947091 9.135946e-01
## StateMinnesota -0.536635448 4.967611e-01
## StateMississippi -0.017815096 8.342791e-01
## StateMissouri 0.269100001 1.125761e+00
## StateMontana -0.272191506 6.390340e-01
## StateNebraska -0.785164685 3.751149e-01
## StateNevada 0.523794997 1.425726e+00
## StateNew Hampshire 0.344297441 1.186171e+00
## StateNew Jersey 0.205208661 1.009586e+00
## StateNew Mexico 0.718470800 1.722455e+00
## StateNew York -0.165333360 7.323136e-01
## StateNorth Carolina 0.242195652 1.117967e+00
## StateNorth Dakota -0.934039304 3.099757e-01
## StateOhio 0.536003460 1.453065e+00
## StateOklahoma 0.486711084 1.328321e+00
## StateOregon -0.109146239 7.567006e-01
## StatePennsylvania 0.504774096 1.442659e+00
## StateRhode Island 0.356882485 1.126908e+00
## StateSouth Carolina 0.287727119 1.167958e+00
## StateSouth Dakota -0.838067506 3.518011e-01
## StateTennessee 0.502599261 1.448056e+00
## StateTexas -0.130307844 7.575153e-01
## StateUtah 0.206190788 9.399313e-01
## StateVermont -0.072701774 7.696853e-01
## StateVirginia -0.033666357 8.257953e-01
## StateWashington 0.167313584 9.885354e-01
## StateWest Virginia 0.971673170 2.184047e+00
## StateWisconsin 0.026570748 9.036570e-01
## StateWyoming 0.135088018 9.169064e-01
## Naloxone_Pharmacy_Yes_Redefined 0.027630479 9.272259e-01
## Naloxone_Pharmacy_No_Redefined 0.046801663 9.707172e-01
## Medical_Marijuana_Redefined 0.107583640 1.018204e+00
## Recreational_Marijuana_Redefined 0.010810452 9.186874e-01
## GSL_Redefined 0.077450703 9.904445e-01
## PDMP_Redefined 0.020749000 9.421592e-01
## Medicaid_Expansion_Redefined 0.132609411 1.067343e+00
## Intervention_Redefined 0.097520349 1.026872e+00
## num_states_w_intervention 0.014711443 9.927022e-01
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.097589752 5.727589e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.005059259 7.596486e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.313092423 1.086243e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.334245657 1.069360e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.504375425 1.167075e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.654518295 1.194993e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.874828710 1.377487e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.249639762 1.815804e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.006964741 1.508553e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.062661245 5.823892e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.093144670 6.729901e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.298655114 1.060776e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.111121849 8.605147e-01
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.278607488 9.302272e-01
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.489330592 1.009922e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.805416791 1.284949e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.269314598 1.793688e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.014884835 1.524639e+00
## s(Time_Period_ID):as.factor(Region)South.1 0.053219311 7.483882e-01
## s(Time_Period_ID):as.factor(Region)South.2 0.135749187 9.304903e-01
## s(Time_Period_ID):as.factor(Region)South.3 0.310014367 1.203285e+00
## s(Time_Period_ID):as.factor(Region)South.4 0.340336945 1.188043e+00
## s(Time_Period_ID):as.factor(Region)South.5 0.480528269 1.168708e+00
## s(Time_Period_ID):as.factor(Region)South.6 0.474613633 1.021349e+00
## s(Time_Period_ID):as.factor(Region)South.7 0.698985460 1.186288e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.028915145 1.450110e+00
## s(Time_Period_ID):as.factor(Region)South.9 0.824201728 1.287014e+00
## s(Time_Period_ID):as.factor(Region)West.1 0.128047102 7.079364e-01
## s(Time_Period_ID):as.factor(Region)West.2 0.208574940 9.361876e-01
## s(Time_Period_ID):as.factor(Region)West.3 0.289047779 1.053430e+00
## s(Time_Period_ID):as.factor(Region)West.4 0.356894529 1.119991e+00
## s(Time_Period_ID):as.factor(Region)West.5 0.364579510 1.002248e+00
## s(Time_Period_ID):as.factor(Region)West.6 0.404707519 9.206288e-01
## s(Time_Period_ID):as.factor(Region)West.7 0.481414773 9.285241e-01
## s(Time_Period_ID):as.factor(Region)West.8 0.651371082 9.658192e-01
## s(Time_Period_ID):as.factor(Region)West.9 0.711992310 1.142170e+00
## exp_coef exp_ub
## (Intercept) 4.962701e-05 6.858996e-05
## StateAlaska 1.319817e+00 1.459021e+00
## StateArizona 1.370008e+00 1.469803e+00
## StateArkansas 6.770966e-01 7.405142e-01
## StateCalifornia 8.530879e-01 9.252640e-01
## StateColorado 1.101560e+00 1.195910e+00
## StateConnecticut 1.208364e+00 1.310832e+00
## StateDelaware 1.537250e+00 1.750337e+00
## StateFlorida 1.287586e+00 1.386937e+00
## StateGeorgia 9.315247e-01 9.942048e-01
## StateHawaii 7.978393e-01 8.834705e-01
## StateIdaho 8.728337e-01 9.517760e-01
## StateIllinois 9.844142e-01 1.072716e+00
## StateIndiana 1.091844e+00 1.171010e+00
## StateIowa 4.770040e-01 5.190430e-01
## StateKansas 7.200815e-01 7.931306e-01
## StateKentucky 1.898636e+00 2.039266e+00
## StateLouisiana 1.341722e+00 1.441368e+00
## StateMaine 1.156530e+00 1.272411e+00
## StateMaryland 3.442559e-01 4.268399e-01
## StateMassachusetts 1.230907e+00 1.364696e+00
## StateMichigan 9.809727e-01 1.053320e+00
## StateMinnesota 5.389456e-01 5.847122e-01
## StateMississippi 9.052889e-01 9.823427e-01
## StateMissouri 1.213829e+00 1.308786e+00
## StateMontana 6.976801e-01 7.617084e-01
## StateNebraska 4.136050e-01 4.560446e-01
## StateNevada 1.551524e+00 1.688423e+00
## StateNew Hampshire 1.293710e+00 1.410998e+00
## StateNew Jersey 1.113351e+00 1.227781e+00
## StateNew Mexico 1.879697e+00 2.051294e+00
## StateNew York 7.878560e-01 8.476111e-01
## StateNorth Carolina 1.193457e+00 1.274043e+00
## StateNorth Dakota 3.490115e-01 3.929632e-01
## StateOhio 1.575920e+00 1.709162e+00
## StateOklahoma 1.470075e+00 1.626956e+00
## StateOregon 8.236852e-01 8.965993e-01
## StatePennsylvania 1.545938e+00 1.656611e+00
## StateRhode Island 1.268938e+00 1.428868e+00
## StateSouth Carolina 1.247937e+00 1.333393e+00
## StateSouth Dakota 3.900898e-01 4.325456e-01
## StateTennessee 1.547144e+00 1.653012e+00
## StateTexas 8.154545e-01 8.778252e-01
## StateUtah 1.074786e+00 1.228988e+00
## StateVermont 8.459985e-01 9.298781e-01
## StateVirginia 8.935640e-01 9.668940e-01
## StateWashington 1.081005e+00 1.182125e+00
## StateWest Virginia 2.402299e+00 2.642362e+00
## StateWisconsin 9.633222e-01 1.026927e+00
## StateWyoming 1.024464e+00 1.144638e+00
## Naloxone_Pharmacy_Yes_Redefined 9.763211e-01 1.028016e+00
## Naloxone_Pharmacy_No_Redefined 1.008577e+00 1.047914e+00
## Medical_Marijuana_Redefined 1.064827e+00 1.113584e+00
## Recreational_Marijuana_Redefined 9.636767e-01 1.010869e+00
## GSL_Redefined 1.034507e+00 1.080529e+00
## PDMP_Redefined 9.807713e-01 1.020966e+00
## Medicaid_Expansion_Redefined 1.103946e+00 1.141804e+00
## Intervention_Redefined 1.063982e+00 1.102434e+00
## num_states_w_intervention 1.003700e+00 1.014820e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 7.207665e-01 9.070209e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 8.693762e-01 9.949535e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.218851e+00 1.367648e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.222201e+00 1.396886e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.390187e+00 1.655951e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.516385e+00 1.924215e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.817650e+00 2.398464e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.517041e+00 3.489086e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.032076e+00 2.737280e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 7.396052e-01 9.392616e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 7.830297e-01 9.110617e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.195815e+00 1.348045e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 9.806385e-01 1.117531e+00
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.108647e+00 1.321289e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.283514e+00 1.631224e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.695653e+00 2.237629e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 2.526397e+00 3.558413e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.050987e+00 2.759046e+00
## s(Time_Period_ID):as.factor(Region)South.1 8.884232e-01 1.054661e+00
## s(Time_Period_ID):as.factor(Region)South.2 1.032366e+00 1.145395e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.280864e+00 1.363445e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.292169e+00 1.405421e+00
## s(Time_Period_ID):as.factor(Region)South.5 1.374670e+00 1.616928e+00
## s(Time_Period_ID):as.factor(Region)South.6 1.281292e+00 1.607393e+00
## s(Time_Period_ID):as.factor(Region)South.7 1.544820e+00 2.011711e+00
## s(Time_Period_ID):as.factor(Region)South.8 2.014311e+00 2.798029e+00
## s(Time_Period_ID):as.factor(Region)South.9 1.713029e+00 2.280060e+00
## s(Time_Period_ID):as.factor(Region)West.1 8.970201e-01 1.136607e+00
## s(Time_Period_ID):as.factor(Region)West.2 1.073922e+00 1.231921e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.185957e+00 1.335156e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.265045e+00 1.428885e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.201310e+00 1.439908e+00
## s(Time_Period_ID):as.factor(Region)West.6 1.174690e+00 1.498864e+00
## s(Time_Period_ID):as.factor(Region)West.7 1.225842e+00 1.618362e+00
## s(Time_Period_ID):as.factor(Region)West.8 1.361104e+00 1.918169e+00
## s(Time_Period_ID):as.factor(Region)West.9 1.525712e+00 2.038048e+00
## sd_coef
## (Intercept) 0.165107575
## StateAlaska 0.051159312
## StateArizona 0.035873238
## StateArkansas 0.045679020
## StateCalifornia 0.041437025
## StateColorado 0.041928643
## StateConnecticut 0.041527830
## StateDelaware 0.066231265
## StateFlorida 0.037923067
## StateGeorgia 0.033224720
## StateHawaii 0.052015664
## StateIdaho 0.044175857
## StateIllinois 0.043827617
## StateIndiana 0.035713980
## StateIowa 0.043092746
## StateKansas 0.049297679
## StateKentucky 0.036456356
## StateLouisiana 0.036550363
## StateMaine 0.048719007
## StateMaryland 0.109705991
## StateMassachusetts 0.052642979
## StateMichigan 0.036304947
## StateMinnesota 0.041584327
## StateMississippi 0.041676586
## StateMissouri 0.038428731
## StateMontana 0.044797477
## StateNebraska 0.049836264
## StateNevada 0.043141360
## StateNew Hampshire 0.044277263
## StateNew Jersey 0.049915502
## StateNew Mexico 0.044571462
## StateNew York 0.037299271
## StateNorth Carolina 0.033337692
## StateNorth Dakota 0.060515869
## StateOhio 0.041410266
## StateOklahoma 0.051733496
## StateOregon 0.043275848
## StatePennsylvania 0.035277153
## StateRhode Island 0.060562513
## StateSouth Carolina 0.033793419
## StateSouth Dakota 0.052709646
## StateTennessee 0.033769722
## StateTexas 0.037602988
## StateUtah 0.068402868
## StateVermont 0.048232612
## StateVirginia 0.040240302
## StateWashington 0.045623584
## StateWest Virginia 0.048595305
## StateWisconsin 0.032621458
## StateWyoming 0.056591294
## Naloxone_Pharmacy_Yes_Redefined 0.026323611
## Naloxone_Pharmacy_No_Redefined 0.019520855
## Medical_Marijuana_Redefined 0.022842650
## Recreational_Marijuana_Redefined 0.024392815
## GSL_Redefined 0.022207180
## PDMP_Redefined 0.020492341
## Medicaid_Expansion_Redefined 0.017203385
## Intervention_Redefined 0.018113135
## num_states_w_intervention 0.005621427
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.117270565
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.068836765
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.058767260
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.068159454
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.089253782
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.121524993
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.141471481
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.166610013
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.151993289
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.121927319
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.077265299
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.061136248
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.066669998
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.089523944
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.122310710
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.141504453
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.174755299
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.151307948
## s(Time_Period_ID):as.factor(Region)South.1 0.087513448
## s(Time_Period_ID):as.factor(Region)South.2 0.053008366
## s(Time_Period_ID):as.factor(Region)South.3 0.031877258
## s(Time_Period_ID):as.factor(Region)South.4 0.042864620
## s(Time_Period_ID):as.factor(Region)South.5 0.082813577
## s(Time_Period_ID):as.factor(Region)South.6 0.115686032
## s(Time_Period_ID):as.factor(Region)South.7 0.134733818
## s(Time_Period_ID):as.factor(Region)South.8 0.167672356
## s(Time_Period_ID):as.factor(Region)South.9 0.145886903
## s(Time_Period_ID):as.factor(Region)West.1 0.120777594
## s(Time_Period_ID):as.factor(Region)West.2 0.070029156
## s(Time_Period_ID):as.factor(Region)West.3 0.060458121
## s(Time_Period_ID):as.factor(Region)West.4 0.062136174
## s(Time_Period_ID):as.factor(Region)West.5 0.092432105
## s(Time_Period_ID):as.factor(Region)West.6 0.124338226
## s(Time_Period_ID):as.factor(Region)West.7 0.141727999
## s(Time_Period_ID):as.factor(Region)West.8 0.175038186
## s(Time_Period_ID):as.factor(Region)West.9 0.147719899
Compile Results
########## Sensitivity Analysis 3: Make Data Frame of Results and 95% CI #############
#store the coefficients into the table
sensitivity_anlys_wo_interp_full_table<-sensitivity_anlys_imputed_od_wo_interp_sd_and_ci
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"Intervention_Redefined",
"num_states_w_intervention")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_wo_interp_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_wo_interp_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(sensitivity_anlys_wo_interp_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_wo_interp_full_table)[i]<-substr(rownames(sensitivity_anlys_wo_interp_full_table)[i], start = 6,
stop = nchar(rownames(sensitivity_anlys_wo_interp_full_table)[i]))
}else if(rownames(sensitivity_anlys_wo_interp_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_wo_interp_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_wo_interp_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_wo_interp_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_wo_interp_full_table)[i],
start = 36,
stop = nchar(rownames(sensitivity_anlys_wo_interp_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_wo_interp_full_table)
## lb_coef coef_values ub_coef exp_lb
## Intercept/Alabama -10.23458613 -9.9109753 -9.58736444 3.590672e-05
## Alaska 0.17722097 0.2774932 0.37776547 1.193895e+00
## Arizona 0.24450529 0.3148168 0.38512838 1.276989e+00
## Arkansas -0.47947221 -0.3899413 -0.30041045 6.191101e-01
## California -0.24010927 -0.1588927 -0.07767613 7.865419e-01
## Colorado 0.01454726 0.0967274 0.17890754 1.014654e+00
## exp_coef exp_ub sd_coef
## Intercept/Alabama 4.962701e-05 6.858996e-05 0.16510758
## Alaska 1.319817e+00 1.459021e+00 0.05115931
## Arizona 1.370008e+00 1.469803e+00 0.03587324
## Arkansas 6.770966e-01 7.405142e-01 0.04567902
## California 8.530879e-01 9.252640e-01 0.04143703
## Colorado 1.101560e+00 1.195910e+00 0.04192864
tail(sensitivity_anlys_wo_interp_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.113320726 0.2351076 0.3568945 1.1199911
## Smoothed Time for Region West.5 0.002245659 0.1834126 0.3645795 1.0022482
## Smoothed Time for Region West.6 -0.082698326 0.1610046 0.4047075 0.9206288
## Smoothed Time for Region West.7 -0.074158982 0.2036279 0.4814148 0.9285241
## Smoothed Time for Region West.8 -0.034778609 0.3082962 0.6513711 0.9658192
## Smoothed Time for Region West.9 0.132930305 0.4224613 0.7119923 1.1421704
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.265045 1.428885 0.06213617
## Smoothed Time for Region West.5 1.201310 1.439908 0.09243210
## Smoothed Time for Region West.6 1.174690 1.498864 0.12433823
## Smoothed Time for Region West.7 1.225842 1.618362 0.14172800
## Smoothed Time for Region West.8 1.361104 1.918169 0.17503819
## Smoothed Time for Region West.9 1.525712 2.038048 0.14771990
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(sensitivity_anlys_wo_interp_full_table) %in% covariates)
sensitivity_anlys_wo_interp_covariate_table<-(round(sensitivity_anlys_wo_interp_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(sensitivity_anlys_wo_interp_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Intervention_Redefined",
"Number of States with Intervention")
#now, reorganize the data so that the covariates are on top and the rest of the variable sare below
sensitivity_anlys_wo_interp_covariate_table<-rbind(sensitivity_anlys_wo_interp_covariate_table,
sensitivity_anlys_wo_interp_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
sensitivity_anlys_wo_interp_covariate_table<-sensitivity_anlys_wo_interp_covariate_table[,
-which(colnames(sensitivity_anlys_wo_interp_covariate_table) %in%
c("lb_coef", "coef_values",
"ub_coef"))]
colnames(sensitivity_anlys_wo_interp_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(sensitivity_anlys_wo_interp_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates
## Naloxone_Pharmacy_Yes 9.272300e-01 9.763200e-01
## Naloxone_Pharmacy_No 9.707200e-01 1.008580e+00
## Medical_Marijuana 1.018200e+00 1.064830e+00
## Recreational_Marijuana 9.186900e-01 9.636800e-01
## GSL 9.904400e-01 1.034510e+00
## PDMP 9.421600e-01 9.807700e-01
## Medicaid_Expansion 1.067340e+00 1.103950e+00
## Intervention_Redefined 1.026870e+00 1.063980e+00
## Number of States with Intervention 9.927000e-01 1.003700e+00
## Intercept/Alabama 3.590672e-05 4.962701e-05
## RR_95_CI_UB standard_error
## Naloxone_Pharmacy_Yes 1.028020e+00 0.0263200
## Naloxone_Pharmacy_No 1.047910e+00 0.0195200
## Medical_Marijuana 1.113580e+00 0.0228400
## Recreational_Marijuana 1.010870e+00 0.0243900
## GSL 1.080530e+00 0.0222100
## PDMP 1.020970e+00 0.0204900
## Medicaid_Expansion 1.141800e+00 0.0172000
## Intervention_Redefined 1.102430e+00 0.0181100
## Number of States with Intervention 1.014820e+00 0.0056200
## Intercept/Alabama 6.858996e-05 0.1651076
#save the table into a CSV
# write.csv(round(sensitivity_anlys_wo_interp_covariate_table, 3), "./Data/coefficients_covariates_1_18_22_wo_interp.csv")
Attributable Deaths
################ Sensitivity Analysis 3: Number of Attributable Deaths #############
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_wo_interp<-sensitivity_anlys_imputed_od_wo_interp_data[
which(sensitivity_anlys_imputed_od_wo_interp_data$Intervention_Redefined>0),]
#compute the probability of overdose had intervention not occurred
prob_od_no_int_wo_interpolation<-expit(-coef(sensitivity_anlys_imputed_od_wo_interp)["Intervention_Redefined"]*
attr_deaths_anlys_wo_interp$Intervention_Redefined
+ logit(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp/attr_deaths_anlys_wo_interp$population))
#compute the lower and upper bounds of 95% CI of probability of overdose had intervention not occurred
#here, we compute the lower and upper bounds of the 95% CI of all the coefficients using the standard error from the model
coef_lb<-sensitivity_anlys_wo_interp_full_table$lb_coef
coef_ub<-sensitivity_anlys_wo_interp_full_table$ub_coef
names(coef_lb) <- names(coef_ub) <- rownames(sensitivity_anlys_wo_interp_full_table)
#we then calculate the upper and lower bounds of the probability of overdose death had intervention not occurred by using
#the lower and upper bounds of the coefficient of the intervention variable
prob_od_no_int_LB_wo_interp<-expit(-coef_lb[names(coef_lb) == "Intervention_Redefined"]*
attr_deaths_anlys_wo_interp$Intervention_Redefined
+ logit(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp/
attr_deaths_anlys_wo_interp$population))
prob_od_no_int_UB_wo_interp<-expit(-coef_ub[names(coef_ub) == "Intervention_Redefined"]*
attr_deaths_anlys_wo_interp$Intervention_Redefined
+ logit(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp/
attr_deaths_anlys_wo_interp$population))
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(sensitivity_anlys_imputed_od_wo_interp_data$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths that attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_wo_interp$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_wo_interp$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp[time_point_index]
- prob_od_no_int_wo_interpolation[time_point_index]*attr_deaths_anlys_wo_interp$population[time_point_index])
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-sum(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp[time_point_index]
- prob_od_no_int_LB_wo_interp[time_point_index]*attr_deaths_anlys_wo_interp$population[time_point_index])
num_attr_od_UB[index]<-sum(attr_deaths_anlys_wo_interp$imputed_deaths_no_interp[time_point_index]
- prob_od_no_int_UB_wo_interp[time_point_index]*attr_deaths_anlys_wo_interp$population[time_point_index])
index<-index + 1
}
num_attr_od_wo_interpolation<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_wo_interp$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_wo_interp$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_wo_interpolation$Num_Attr_Deaths)
## [1] 33215.68
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_wo_interpolation<-num_attr_od_wo_interpolation %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths), death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_wo_interpolation$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 29.91 755.56 1413.82 1660.78 2313.50 3696.16
Sensitivity Analysis 4: Effect of DIH Prosecutions on Unintentional Overdose Deaths, Assuming Effect Lasts for Two Years
Analysis
########### Sensitivity Analysis 4: Two Year Intervention Effect ######################
#create a plot for each state to see how many prosecution media alerts there are per 6 month period
#read in the prosecution media alert data
prosecution_data<-read.csv("./Data/dih_prosecutions_9_6_21.csv")
#data cleaning
prosecution_data<-prosecution_data %>%
mutate(Date = as.Date(Date.charged, "%m/%d/%Y")) %>%
mutate(State = ifelse(State.Filed == "pennsylvania", "Pennsylvania", State.Filed),
State = ifelse(State.Filed == "Virginia ", "Virginia", State)) %>%
filter(!is.na(Date), State.Filed != "No Info", State.Filed != "No info", State.Filed != "No Info ",
State != "")
#clean up the data by looking at the link to the article
prosecution_data$Date[prosecution_data$Date == "2026-08-01"] <- as.Date("2016-02-15", "%Y-%m-%d")
#change the states into Character instead of factor
prosecution_data$State<-as.character(prosecution_data$State)
#see how many prosecution data points there are for each state
table(prosecution_data$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 76
Colorado Connecticut Delaware Florida Georgia
32 47 3 138 29
Idaho Illinois Indiana Iowa Kansas
9 342 55 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 63 34
Michigan Minnesota Mississippi Missouri Montana
116 140 1 45 11
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 137 4
New York North Carolina North Dakota Ohio Oklahoma
110 124 53 404 41
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 726 2 12 13
Tennessee Texas Utah Vermont Virginia
94 44 21 13 63
Washington West Virginia Wisconsin Wyoming
78 33 381 19
#there are some repeated cases depending on victim
prosecution_data_unique <- prosecution_data %>%
group_by(State) %>%
distinct(Accused.Name, Date, .keep_all = T)
table(prosecution_data_unique$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 72
Colorado Connecticut Delaware Florida Georgia
30 46 3 134 26
Idaho Illinois Indiana Iowa Kansas
9 336 53 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 62 34
Michigan Minnesota Mississippi Missouri Montana
114 140 1 44 10
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 131 4
New York North Carolina North Dakota Ohio Oklahoma
105 121 40 395 34
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 718 2 12 13
Tennessee Texas Utah Vermont Virginia
94 43 21 13 63
Washington West Virginia Wisconsin Wyoming
75 33 373 19
#change date charged into Date object
prosecution_data_unique$Date<-mdy(prosecution_data_unique$Date.charged)
#group the data into six month periods
prosecution_data_unique<-prosecution_data_unique %>%
mutate(six_month_pd = lubridate::floor_date(Date , "6 months" ))
# #######ONLY IF GROUPS######
# prosecution_grouped <- prosecution_data_unique %>%
# #filter to dates after 2000 and dates before 2020
# filter(year(six_month_pd) >= 2000 & year(six_month_pd) <= 2019) %>%
# group_by(State, six_month_pd) %>%
# #for each state, for each six month period, count the number of DIH prosecutions
# summarise(num_dih = n()) %>%
# #label the groups according to zero, low, or high
# mutate(group = ifelse(num_dih == 0, "zero", ifelse(num_dih >= 5, "high", "low"))) %>%
# ungroup() %>%
# #have to add in a row for hawaii because its not in the prosecution dataset
# add_row(State = "Hawaii", six_month_pd = as.Date("2000-01-01"), num_dih = 0, group = "zero")
#
# #we compute the final group for each state by seeing if it ever hits high or low
# prosecution_grouped_final <- prosecution_grouped %>%
# group_by(State) %>%
# summarise(final_gp = ifelse(sum(group == "high") > 0, "high", ifelse(sum(group == "low")> 0, "low", "zero")))
#
# ggplot(prosecution_grouped_final, aes(final_gp)) +
# geom_bar() +
# labs(title = "Number of States by DIH prosecution Category, with Low = [1,5]") +
# geom_text(aes(label = ..count..), stat = "count", vjust = -.75)
#
# #number of DIH prosecutions per six month for each state
# # pdf("Figures/num_dih_per_six_month_pd_by_state_11_12_21.pdf")
# ggplot(prosecution_grouped, aes(x = six_month_pd, y = num_dih)) +
# geom_bar(stat = "identity") +
# facet_wrap(~State) +
# theme(axis.text.x = element_text(angle = 30, size = 5))
# # dev.off()
#
# # write.csv(prosecution_grouped, "./Data/num_dih_per_six_month_pd_by_state_11_12_21.csv")
#
#count the number of prosecution media alerts in each six month period
#we also get the first and last date of prosecution in time period
prosecution_data_by_six_month_pd <- prosecution_data_unique %>%
filter(year(six_month_pd)>1999 & year(six_month_pd)<2020) %>%
group_by(State, six_month_pd) %>%
summarise(first_date_in_pd = min(Date), last_date_in_pd = max(Date))
#create the data set used for this sensitivity analysis
#first, we merge the grouped prosecution data set with the main data set by state and time period
sensitivity_anlys_redefine_int_data<-merge(main_analysis_data,
prosecution_data_by_six_month_pd,
by.x = c("State", "Time_Period_Start"),
by.y = c("State", "six_month_pd"), all = TRUE)
#create a intervention 2 year effect variable by initializing it to be all 0
sensitivity_anlys_redefine_int_data<-sensitivity_anlys_redefine_int_data %>%
group_by(State) %>%
mutate(int_2_yr_effect = 0)
#change the date into a date object
sensitivity_anlys_redefine_int_data$Time_Period_Start<-as.Date(sensitivity_anlys_redefine_int_data$Time_Period_Start)
sensitivity_anlys_redefine_int_data$Time_Period_End<-as.Date(sensitivity_anlys_redefine_int_data$Time_Period_End)
#we need to impute the newly defined intervention variable depending on the case
#by examining each row of the data set
for(state in unique(sensitivity_anlys_redefine_int_data$State)){
#first, subset the data set into state_data which only contains the data for the state
state_index<-which(sensitivity_anlys_redefine_int_data$State == state)
state_data<-sensitivity_anlys_redefine_int_data[state_index,]
#note that the first four rows of the 2 year effect intervention variable are the same as the
#first four rows of the original intervention variable
state_data$int_2_yr_effect[1:4]<-state_data$Intervention_Redefined[1:4]
for(i in 5:nrow(state_data)){
#next, we deal with the rows where there was at least one prosecution in the last 3 six month periods
#These rows will be imputed with a 1
if((!is.na(state_data$first_date_in_pd[i - 1]) |
!is.na(state_data$first_date_in_pd[i - 2]) |
!is.na(state_data$first_date_in_pd[i - 3]))){
state_data$int_2_yr_effect[i]<-1
}else{
#next, we account for the rows with the fractions:
# 1) an intervention occurs in row i without an intervention 2 years ago
# 2) row i contains the lasting effects of an intervention that occurred 2 years ago
# 3) row i contains effects from both a new intervention starting in row i and lasting
# effects from 2 years ago
#To compute the fraction, we add the number of days that are affected by an intervention
#(from both the current prosecution and previous prosecution) and then divide by the total
#number of days in the period:
total_len_of_pd<-as.numeric(state_data$Time_Period_End[i] - state_data$Time_Period_Start[i])
#If there is no prosecution two years ago, i.e. in period i-4, then the last_date is the first
#date in period i. We subtract the last_date by the first date in the period, so we will get
#a 0 for the number of days that are affected by a prosecution from period i-4. Otherwise,
#the last_date is the last date of prosecution from period i-4, plus 2 years.
len_of_past_effect <- ifelse(!is.na(state_data$first_date_in_pd[i - 4]),
(state_data$last_date_in_pd[i - 4] + years(2)) - state_data$Time_Period_Start[i],
0)
#If there is no prosecution in the period i, then the start_date is the last date in the period i.
#We subtract start_date from the last date in period i, so we will get a 0 for the number
#of days that are affected by a prosecution in period i. Otherwise, the start_date is the
#first date of a prosecution in period i.
len_of_current_effect <- ifelse(!is.na(state_data$first_date_in_pd[i]),
as.numeric(state_data$Time_Period_End[i] - state_data$first_date_in_pd[i]),
0)
state_data$int_2_yr_effect[i]<-(len_of_past_effect + len_of_current_effect)/total_len_of_pd
}
}
#for the case where the int_2_yr_effect is greater than 1 (could result when we add the effects of
#previous intervention and the current intervention), we just impute a 1 instead
state_data$int_2_yr_effect[state_data$int_2_yr_effect>1]<-1
#lastly, we store the int_2_yr_effect variable into the sensitivity analysis data set
sensitivity_anlys_redefine_int_data$int_2_yr_effect[state_index]<-state_data$int_2_yr_effect
}
#view the data set just to make sure the imputation looks right
# View(sensitivity_anlys_redefine_int_data %>% select(State, Time_Period_Start, Time_Period_End,
# Intervention_Redefined, first_date_in_pd,
# last_date_in_pd,
# int_2_yr_effect))
sensitivity_anlys_redefine_int_data <- sensitivity_anlys_redefine_int_data %>%
group_by(Time_Period_Start) %>%
mutate(num_states_w_intervention_2_yr_effect = sum(int_2_yr_effect))
#run the analysis on the sensitivity analysis data
sensitivity_anlys_redefine_int_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
int_2_yr_effect +
num_states_w_intervention_2_yr_effect,
data = sensitivity_anlys_redefine_int_data, family = "binomial")
stargazer(sensitivity_anlys_redefine_int_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.264***
|
|
|
(0.028)
|
|
|
|
|
StateArizona
|
0.315***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.369***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.157***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.087***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.179***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.420***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.248***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.056***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.241***
|
|
|
(0.025)
|
|
|
|
|
StateIdaho
|
-0.142***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.021
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.082***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.740***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.310***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.634***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.293***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.142***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.067***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.208***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.028**
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.628***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.089***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.197***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.354***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.863***
|
|
|
(0.029)
|
|
|
|
|
StateNevada
|
0.443***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.250***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.110***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.641***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.244***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.177***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.060***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.450***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.381***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.202***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.430***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.245***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.216***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-0.965***
|
|
|
(0.043)
|
|
|
|
|
StateTennessee
|
0.446***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.197***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.081***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.162***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.114***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.064***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.868***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.040***
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.026
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.034***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.003
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.067***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.039***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.036***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.017***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.103***
|
|
|
(0.006)
|
|
|
|
|
int_2_yr_effect
|
0.058***
|
|
|
(0.005)
|
|
|
|
|
num_states_w_intervention_2_yr_effect
|
-0.002**
|
|
|
(0.001)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.738***
|
|
|
(0.028)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.911
|
|
Log Likelihood
|
-16,745.360
|
|
UBRE
|
8.835
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
sensitivity_anlys_redefine_int_w_basis_functions <- data.frame(predict(sensitivity_anlys_redefine_int_model, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_redefine_int_coefficient_values <- coef(sensitivity_anlys_redefine_int_model)
#type = "response" to get the estimated probabilities
sensitivity_anlys_redefine_int_pred_prob <- predict(sensitivity_anlys_redefine_int_model,
newdata = sensitivity_anlys_redefine_int_data, type = "response")
sensitivity_anlys_redefine_int_sd_and_ci <- compute_sd_and_CI(sensitivity_anlys_redefine_int_w_basis_functions,
sensitivity_anlys_redefine_int_data$population,
sensitivity_anlys_redefine_int_data$imputed_deaths,
sensitivity_anlys_redefine_int_pred_prob,
sensitivity_anlys_redefine_int_coefficient_values)
sensitivity_anlys_redefine_int_sd_and_ci
## lb_coef coef_values
## (Intercept) -9.907505779 -9.737771252
## StateAlaska 0.163177884 0.263527810
## StateArizona 0.244878343 0.315394401
## StateArkansas -0.459643659 -0.369414931
## StateCalifornia -0.239265766 -0.157384034
## StateColorado 0.004347103 0.087005464
## StateConnecticut 0.096343818 0.179120542
## StateDelaware 0.291299014 0.420461658
## StateFlorida 0.172631934 0.248384532
## StateGeorgia -0.121536283 -0.055728270
## StateHawaii -0.341359163 -0.240700027
## StateIdaho -0.229441819 -0.141736838
## StateIllinois -0.107431620 -0.020501556
## StateIndiana 0.011535566 0.082121847
## StateIowa -0.825062135 -0.739686479
## StateKansas -0.405963640 -0.310044217
## StateKentucky 0.563199491 0.634430992
## StateLouisiana 0.221281933 0.293420498
## StateMaine 0.045955107 0.142147676
## StateMaryland -1.280313519 -1.067357140
## StateMassachusetts 0.104171059 0.207658146
## StateMichigan -0.100614931 -0.027978126
## StateMinnesota -0.710179493 -0.627717375
## StateMississippi -0.165521594 -0.089339871
## StateMissouri 0.120630886 0.196517118
## StateMontana -0.444339658 -0.353626919
## StateNebraska -0.957132013 -0.862968400
## StateNevada 0.357762234 0.443411576
## StateNew Hampshire 0.163182411 0.250244307
## StateNew Jersey 0.012724787 0.109659747
## StateNew Mexico 0.554725076 0.640977428
## StateNew York -0.318901715 -0.244495717
## StateNorth Carolina 0.110839208 0.176858589
## StateNorth Dakota -1.178815690 -1.060283820
## StateOhio 0.368317306 0.450298403
## StateOklahoma 0.280336161 0.380746668
## StateOregon -0.286881837 -0.201809236
## StatePennsylvania 0.359593326 0.429853032
## StateRhode Island 0.127495512 0.245094454
## StateSouth Carolina 0.149895996 0.215623276
## StateSouth Dakota -1.064557951 -0.965347816
## StateTennessee 0.378067136 0.445548036
## StateTexas -0.272053519 -0.196808644
## StateUtah -0.053241139 0.080817930
## StateVermont -0.256755176 -0.162468820
## StateVirginia -0.193468913 -0.113666281
## StateWashington -0.024472130 0.064277415
## StateWest Virginia 0.772415350 0.867687944
## StateWisconsin -0.105143978 -0.040331178
## StateWyoming -0.089093643 0.025715376
## Naloxone_Pharmacy_Yes_Redefined -0.086539038 -0.034128542
## Naloxone_Pharmacy_No_Redefined -0.035648316 0.002860111
## Medical_Marijuana_Redefined 0.022070513 0.067481486
## Recreational_Marijuana_Redefined -0.086254468 -0.039192355
## GSL_Redefined -0.008074801 0.036084911
## PDMP_Redefined -0.056614557 -0.016824651
## Medicaid_Expansion_Redefined 0.068892000 0.102723519
## int_2_yr_effect 0.025877059 0.057551162
## num_states_w_intervention_2_yr_effect -0.008856911 -0.002456742
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.584084391 -0.401055001
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.301987743 -0.186628073
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.073077263 0.185545116
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.113711008 0.231110854
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.289174653 0.411209666
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.391955568 0.530838249
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.562893249 0.737840852
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.899275493 1.098201696
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.667506881 0.857760074
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.575949994 -0.378903166
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.432068899 -0.296239509
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.039497963 0.154686732
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.094747510 0.017923134
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.069300915 0.191578309
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.231910000 0.372612386
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.497555443 0.669190885
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.895585360 1.098741583
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.668093519 0.865713651
## s(Time_Period_ID):as.factor(Region)South.1 -0.308467780 -0.197029602
## s(Time_Period_ID):as.factor(Region)South.2 -0.086853379 -0.010281232
## s(Time_Period_ID):as.factor(Region)South.3 0.182237045 0.245089031
## s(Time_Period_ID):as.factor(Region)South.4 0.228751448 0.285480380
## s(Time_Period_ID):as.factor(Region)South.5 0.295708441 0.396277019
## s(Time_Period_ID):as.factor(Region)South.6 0.249816168 0.365242376
## s(Time_Period_ID):as.factor(Region)South.7 0.418212450 0.574245289
## s(Time_Period_ID):as.factor(Region)South.8 0.691766235 0.876149791
## s(Time_Period_ID):as.factor(Region)South.9 0.508058978 0.688383598
## s(Time_Period_ID):as.factor(Region)West.1 -0.380745998 -0.191652954
## s(Time_Period_ID):as.factor(Region)West.2 -0.073979917 0.041361966
## s(Time_Period_ID):as.factor(Region)West.3 0.054152807 0.171490850
## s(Time_Period_ID):as.factor(Region)West.4 0.151841605 0.258172489
## s(Time_Period_ID):as.factor(Region)West.5 0.130904453 0.262491840
## s(Time_Period_ID):as.factor(Region)West.6 0.119317378 0.267441841
## s(Time_Period_ID):as.factor(Region)West.7 0.176490220 0.350125046
## s(Time_Period_ID):as.factor(Region)West.8 0.275280739 0.482619887
## s(Time_Period_ID):as.factor(Region)West.9 0.386436193 0.573660927
## ub_coef exp_lb
## (Intercept) -9.568036724 4.979949e-05
## StateAlaska 0.363877737 1.177246e+00
## StateArizona 0.385910458 1.277466e+00
## StateArkansas -0.279186202 6.315086e-01
## StateCalifornia -0.075502303 7.872056e-01
## StateColorado 0.169663824 1.004357e+00
## StateConnecticut 0.261897266 1.101138e+00
## StateDelaware 0.549624303 1.338165e+00
## StateFlorida 0.324137130 1.188429e+00
## StateGeorgia 0.010079743 8.855589e-01
## StateHawaii -0.140040890 7.108036e-01
## StateIdaho -0.054031858 7.949772e-01
## StateIllinois 0.066428509 8.981379e-01
## StateIndiana 0.152708128 1.011602e+00
## StateIowa -0.654310823 4.382078e-01
## StateKansas -0.214124794 6.663344e-01
## StateKentucky 0.705662493 1.756283e+00
## StateLouisiana 0.365559062 1.247675e+00
## StateMaine 0.238340245 1.047027e+00
## StateMaryland -0.854400761 2.779501e-01
## StateMassachusetts 0.311145233 1.109790e+00
## StateMichigan 0.044658679 9.042812e-01
## StateMinnesota -0.545255258 4.915560e-01
## StateMississippi -0.013158148 8.474516e-01
## StateMissouri 0.272403351 1.128208e+00
## StateMontana -0.262914179 6.412476e-01
## StateNebraska -0.768804787 3.839926e-01
## StateNevada 0.529060918 1.430126e+00
## StateNew Hampshire 0.337306203 1.177251e+00
## StateNew Jersey 0.206594706 1.012806e+00
## StateNew Mexico 0.727229781 1.741462e+00
## StateNew York -0.170089718 7.269470e-01
## StateNorth Carolina 0.242877971 1.117215e+00
## StateNorth Dakota -0.941751949 3.076429e-01
## StateOhio 0.532279499 1.445301e+00
## StateOklahoma 0.481157175 1.323575e+00
## StateOregon -0.116736635 7.506004e-01
## StatePennsylvania 0.500112737 1.432747e+00
## StateRhode Island 0.362693396 1.135980e+00
## StateSouth Carolina 0.281350556 1.161713e+00
## StateSouth Dakota -0.866137681 3.448803e-01
## StateTennessee 0.513028936 1.459461e+00
## StateTexas -0.121563768 7.618135e-01
## StateUtah 0.214876999 9.481513e-01
## StateVermont -0.068182465 7.735576e-01
## StateVirginia -0.033863650 8.240955e-01
## StateWashington 0.153026960 9.758249e-01
## StateWest Virginia 0.962960538 2.164989e+00
## StateWisconsin 0.024481621 9.001949e-01
## StateWyoming 0.140524395 9.147599e-01
## Naloxone_Pharmacy_Yes_Redefined 0.018281953 9.170997e-01
## Naloxone_Pharmacy_No_Redefined 0.041368539 9.649796e-01
## Medical_Marijuana_Redefined 0.112892459 1.022316e+00
## Recreational_Marijuana_Redefined 0.007869758 9.173608e-01
## GSL_Redefined 0.080244623 9.919577e-01
## PDMP_Redefined 0.022965255 9.449582e-01
## Medicaid_Expansion_Redefined 0.136555038 1.071321e+00
## int_2_yr_effect 0.089225266 1.026215e+00
## num_states_w_intervention_2_yr_effect 0.003943428 9.911822e-01
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.218025612 5.576162e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.071268404 7.393471e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.298012968 1.075814e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.348510699 1.120428e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.533244680 1.335325e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.669720930 1.479872e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.912788455 1.755745e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.297127899 2.457822e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.048013267 1.949371e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.181856338 5.621706e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.160410119 6.491646e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.269875501 1.040288e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.130593778 9.096026e-01
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.313855703 1.071759e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.513314772 1.261006e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.840826326 1.644696e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.301897807 2.448769e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.063333784 1.950515e+00
## s(Time_Period_ID):as.factor(Region)South.1 -0.085591425 7.345716e-01
## s(Time_Period_ID):as.factor(Region)South.2 0.066290916 9.168115e-01
## s(Time_Period_ID):as.factor(Region)South.3 0.307941017 1.199899e+00
## s(Time_Period_ID):as.factor(Region)South.4 0.342209313 1.257030e+00
## s(Time_Period_ID):as.factor(Region)South.5 0.496845597 1.344078e+00
## s(Time_Period_ID):as.factor(Region)South.6 0.480668585 1.283789e+00
## s(Time_Period_ID):as.factor(Region)South.7 0.730278128 1.519243e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.060533347 1.997240e+00
## s(Time_Period_ID):as.factor(Region)South.9 0.868708219 1.662062e+00
## s(Time_Period_ID):as.factor(Region)West.1 -0.002559909 6.833514e-01
## s(Time_Period_ID):as.factor(Region)West.2 0.156703848 9.286903e-01
## s(Time_Period_ID):as.factor(Region)West.3 0.288828894 1.055646e+00
## s(Time_Period_ID):as.factor(Region)West.4 0.364503372 1.163976e+00
## s(Time_Period_ID):as.factor(Region)West.5 0.394079227 1.139859e+00
## s(Time_Period_ID):as.factor(Region)West.6 0.415566305 1.126727e+00
## s(Time_Period_ID):as.factor(Region)West.7 0.523759873 1.193023e+00
## s(Time_Period_ID):as.factor(Region)West.8 0.689959035 1.316900e+00
## s(Time_Period_ID):as.factor(Region)West.9 0.760885661 1.471726e+00
## exp_coef exp_ub
## (Intercept) 5.901191e-05 6.992854e-05
## StateAlaska 1.301513e+00 1.438898e+00
## StateArizona 1.370800e+00 1.470953e+00
## StateArkansas 6.911386e-01 7.563990e-01
## StateCalifornia 8.543759e-01 9.272776e-01
## StateColorado 1.090903e+00 1.184906e+00
## StateConnecticut 1.196165e+00 1.299393e+00
## StateDelaware 1.522664e+00 1.732602e+00
## StateFlorida 1.281953e+00 1.382837e+00
## StateGeorgia 9.457961e-01 1.010131e+00
## StateHawaii 7.860774e-01 8.693227e-01
## StateIdaho 8.678496e-01 9.474019e-01
## StateIllinois 9.797072e-01 1.068685e+00
## StateIndiana 1.085588e+00 1.164985e+00
## StateIowa 4.772635e-01 5.198002e-01
## StateKansas 7.334145e-01 8.072476e-01
## StateKentucky 1.885949e+00 2.025188e+00
## StateLouisiana 1.341007e+00 1.441320e+00
## StateMaine 1.152747e+00 1.269141e+00
## StateMaryland 3.439162e-01 4.255381e-01
## StateMassachusetts 1.230792e+00 1.364987e+00
## StateMichigan 9.724096e-01 1.045671e+00
## StateMinnesota 5.338089e-01 5.796938e-01
## StateMississippi 9.145347e-01 9.869280e-01
## StateMissouri 1.217156e+00 1.313117e+00
## StateMontana 7.021369e-01 7.688079e-01
## StateNebraska 4.219078e-01 4.635668e-01
## StateNevada 1.558013e+00 1.697338e+00
## StateNew Hampshire 1.284339e+00 1.401168e+00
## StateNew Jersey 1.115898e+00 1.229484e+00
## StateNew Mexico 1.898335e+00 2.069340e+00
## StateNew York 7.830993e-01 8.435891e-01
## StateNorth Carolina 1.193462e+00 1.274913e+00
## StateNorth Dakota 3.463575e-01 3.899441e-01
## StateOhio 1.568780e+00 1.702809e+00
## StateOklahoma 1.463377e+00 1.617946e+00
## StateOregon 8.172508e-01 8.898195e-01
## StatePennsylvania 1.537032e+00 1.648907e+00
## StateRhode Island 1.277742e+00 1.437195e+00
## StateSouth Carolina 1.240635e+00 1.324918e+00
## StateSouth Dakota 3.808507e-01 4.205728e-01
## StateTennessee 1.561346e+00 1.670343e+00
## StateTexas 8.213478e-01 8.855346e-01
## StateUtah 1.084173e+00 1.239709e+00
## StateVermont 8.500426e-01 9.340900e-01
## StateVirginia 8.925558e-01 9.667033e-01
## StateWashington 1.066388e+00 1.165356e+00
## StateWest Virginia 2.381399e+00 2.619440e+00
## StateWisconsin 9.604713e-01 1.024784e+00
## StateWyoming 1.026049e+00 1.150877e+00
## Naloxone_Pharmacy_Yes_Redefined 9.664473e-01 1.018450e+00
## Naloxone_Pharmacy_No_Redefined 1.002864e+00 1.042236e+00
## Medical_Marijuana_Redefined 1.069810e+00 1.119512e+00
## Recreational_Marijuana_Redefined 9.615657e-01 1.007901e+00
## GSL_Redefined 1.036744e+00 1.083552e+00
## PDMP_Redefined 9.833161e-01 1.023231e+00
## Medicaid_Expansion_Redefined 1.108185e+00 1.146318e+00
## int_2_yr_effect 1.059239e+00 1.093327e+00
## num_states_w_intervention_2_yr_effect 9.975463e-01 1.003951e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 6.696132e-01 8.041048e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 8.297523e-01 9.312119e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.203875e+00 1.347179e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.259999e+00 1.416956e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.508642e+00 1.704454e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.700357e+00 1.953692e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 2.091415e+00 2.491260e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.998768e+00 3.658773e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.357873e+00 2.851979e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 6.846119e-01 8.337211e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 7.436093e-01 8.517944e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.167292e+00 1.309801e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 1.018085e+00 1.139505e+00
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.211160e+00 1.368692e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.451522e+00 1.670820e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.952657e+00 2.318282e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 3.000388e+00 3.676267e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.376702e+00 2.896010e+00
## s(Time_Period_ID):as.factor(Region)South.1 8.211663e-01 9.179692e-01
## s(Time_Period_ID):as.factor(Region)South.2 9.897714e-01 1.068538e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.277735e+00 1.360621e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.330401e+00 1.408055e+00
## s(Time_Period_ID):as.factor(Region)South.5 1.486281e+00 1.643529e+00
## s(Time_Period_ID):as.factor(Region)South.6 1.440863e+00 1.617155e+00
## s(Time_Period_ID):as.factor(Region)South.7 1.775790e+00 2.075658e+00
## s(Time_Period_ID):as.factor(Region)South.8 2.401635e+00 2.887911e+00
## s(Time_Period_ID):as.factor(Region)South.9 1.990495e+00 2.383829e+00
## s(Time_Period_ID):as.factor(Region)West.1 8.255933e-01 9.974434e-01
## s(Time_Period_ID):as.factor(Region)West.2 1.042229e+00 1.169649e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.187073e+00 1.334863e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.294562e+00 1.439799e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.300166e+00 1.483018e+00
## s(Time_Period_ID):as.factor(Region)West.6 1.306618e+00 1.515229e+00
## s(Time_Period_ID):as.factor(Region)West.7 1.419245e+00 1.688364e+00
## s(Time_Period_ID):as.factor(Region)West.8 1.620314e+00 1.993634e+00
## s(Time_Period_ID):as.factor(Region)West.9 1.774752e+00 2.140171e+00
## sd_coef
## (Intercept) 0.086599249
## StateAlaska 0.051198942
## StateArizona 0.035977580
## StateArkansas 0.046035066
## StateCalifornia 0.041776394
## StateColorado 0.042172633
## StateConnecticut 0.042233023
## StateDelaware 0.065899308
## StateFlorida 0.038649285
## StateGeorgia 0.033575517
## StateHawaii 0.051356702
## StateIdaho 0.044747439
## StateIllinois 0.044352074
## StateIndiana 0.036013409
## StateIowa 0.043559008
## StateKansas 0.048938481
## StateKentucky 0.036342603
## StateLouisiana 0.036805390
## StateMaine 0.049077841
## StateMaryland 0.108651214
## StateMassachusetts 0.052799534
## StateMichigan 0.037059594
## StateMinnesota 0.042072509
## StateMississippi 0.038868226
## StateMissouri 0.038717465
## StateMontana 0.046282010
## StateNebraska 0.048042660
## StateNevada 0.043698644
## StateNew Hampshire 0.044419335
## StateNew Jersey 0.049456612
## StateNew Mexico 0.044006302
## StateNew York 0.037962244
## StateNorth Carolina 0.033683358
## StateNorth Dakota 0.060475444
## StateOhio 0.041827090
## StateOklahoma 0.051229850
## StateOregon 0.043404388
## StatePennsylvania 0.035846788
## StateRhode Island 0.059999460
## StateSouth Carolina 0.033534326
## StateSouth Dakota 0.050617416
## StateTennessee 0.034429031
## StateTexas 0.038390243
## StateUtah 0.068397484
## StateVermont 0.048105284
## StateVirginia 0.040715628
## StateWashington 0.045280380
## StateWest Virginia 0.048608466
## StateWisconsin 0.033067755
## StateWyoming 0.058576030
## Naloxone_Pharmacy_Yes_Redefined 0.026740049
## Naloxone_Pharmacy_No_Redefined 0.019647157
## Medical_Marijuana_Redefined 0.023168864
## Recreational_Marijuana_Redefined 0.024011282
## GSL_Redefined 0.022530465
## PDMP_Redefined 0.020300972
## Medicaid_Expansion_Redefined 0.017260979
## int_2_yr_effect 0.016160257
## num_states_w_intervention_2_yr_effect 0.003265393
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.093382341
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.058856974
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.057381557
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.059897881
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.062262762
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.070858511
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.089258981
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.101492961
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.097067956
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.100534096
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.069300709
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.058769780
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.057485023
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.062386425
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.071786932
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.087569103
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.103651134
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.100826598
## s(Time_Period_ID):as.factor(Region)South.1 0.056856213
## s(Time_Period_ID):as.factor(Region)South.2 0.039067422
## s(Time_Period_ID):as.factor(Region)South.3 0.032067340
## s(Time_Period_ID):as.factor(Region)South.4 0.028943333
## s(Time_Period_ID):as.factor(Region)South.5 0.051310499
## s(Time_Period_ID):as.factor(Region)South.6 0.058890923
## s(Time_Period_ID):as.factor(Region)South.7 0.079608591
## s(Time_Period_ID):as.factor(Region)South.8 0.094073243
## s(Time_Period_ID):as.factor(Region)South.9 0.092002357
## s(Time_Period_ID):as.factor(Region)West.1 0.096476043
## s(Time_Period_ID):as.factor(Region)West.2 0.058847899
## s(Time_Period_ID):as.factor(Region)West.3 0.059866349
## s(Time_Period_ID):as.factor(Region)West.4 0.054250451
## s(Time_Period_ID):as.factor(Region)West.5 0.067136422
## s(Time_Period_ID):as.factor(Region)West.6 0.075573706
## s(Time_Period_ID):as.factor(Region)West.7 0.088589197
## s(Time_Period_ID):as.factor(Region)West.8 0.105785280
## s(Time_Period_ID):as.factor(Region)West.9 0.095522823
Plots
plot(sensitivity_anlys_redefine_int_model, pages = 1)

Compile Results
############## Sensitivity Analysis 4: Make Data Frame of Results and 95% CI ##########
#store the coefficients into the table
sensitivity_anlys_redefine_int_full_table<-sensitivity_anlys_redefine_int_sd_and_ci
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"int_2_yr_effect",
"num_states_w_intervention_2_yr_effect")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_redefine_int_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_redefine_int_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(sensitivity_anlys_redefine_int_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_redefine_int_full_table)[i]<-substr(rownames(sensitivity_anlys_redefine_int_full_table)[i], start = 6,
stop = nchar(rownames(sensitivity_anlys_redefine_int_full_table)[i]))
}else if(rownames(sensitivity_anlys_redefine_int_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_redefine_int_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_redefine_int_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_redefine_int_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_redefine_int_full_table)[i], start = 36,
stop = nchar(rownames(sensitivity_anlys_redefine_int_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_redefine_int_full_table)
## lb_coef coef_values ub_coef exp_lb exp_coef
## Intercept/Alabama -9.907505779 -9.73777125 -9.5680367 4.979949e-05 5.901191e-05
## Alaska 0.163177884 0.26352781 0.3638777 1.177246e+00 1.301513e+00
## Arizona 0.244878343 0.31539440 0.3859105 1.277466e+00 1.370800e+00
## Arkansas -0.459643659 -0.36941493 -0.2791862 6.315086e-01 6.911386e-01
## California -0.239265766 -0.15738403 -0.0755023 7.872056e-01 8.543759e-01
## Colorado 0.004347103 0.08700546 0.1696638 1.004357e+00 1.090903e+00
## exp_ub sd_coef
## Intercept/Alabama 6.992854e-05 0.08659925
## Alaska 1.438898e+00 0.05119894
## Arizona 1.470953e+00 0.03597758
## Arkansas 7.563990e-01 0.04603507
## California 9.272776e-01 0.04177639
## Colorado 1.184906e+00 0.04217263
tail(sensitivity_anlys_redefine_int_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.1518416 0.2581725 0.3645034 1.163976
## Smoothed Time for Region West.5 0.1309045 0.2624918 0.3940792 1.139859
## Smoothed Time for Region West.6 0.1193174 0.2674418 0.4155663 1.126727
## Smoothed Time for Region West.7 0.1764902 0.3501250 0.5237599 1.193023
## Smoothed Time for Region West.8 0.2752807 0.4826199 0.6899590 1.316900
## Smoothed Time for Region West.9 0.3864362 0.5736609 0.7608857 1.471726
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.294562 1.439799 0.05425045
## Smoothed Time for Region West.5 1.300166 1.483018 0.06713642
## Smoothed Time for Region West.6 1.306618 1.515229 0.07557371
## Smoothed Time for Region West.7 1.419245 1.688364 0.08858920
## Smoothed Time for Region West.8 1.620314 1.993634 0.10578528
## Smoothed Time for Region West.9 1.774752 2.140171 0.09552282
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(sensitivity_anlys_redefine_int_full_table) %in% covariates)
sensitivity_anlys_redefine_int_covariate_table<-(round(sensitivity_anlys_redefine_int_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(sensitivity_anlys_redefine_int_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Two Year Intervention Effect",
"Number of States w Intervention")
#now, reorganize the data so that the covariates are on top and the rest of the variable sare below
sensitivity_anlys_redefine_int_covariate_table<-rbind(sensitivity_anlys_redefine_int_covariate_table,
sensitivity_anlys_redefine_int_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
sensitivity_anlys_redefine_int_covariate_table<-sensitivity_anlys_redefine_int_covariate_table[,
-which(colnames(sensitivity_anlys_redefine_int_covariate_table) %in%
c("lb_coef",
"coef_values",
"ub_coef"))]
colnames(sensitivity_anlys_redefine_int_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(sensitivity_anlys_redefine_int_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates RR_95_CI_UB
## Naloxone_Pharmacy_Yes 9.171000e-01 9.664500e-01 1.018450e+00
## Naloxone_Pharmacy_No 9.649800e-01 1.002860e+00 1.042240e+00
## Medical_Marijuana 1.022320e+00 1.069810e+00 1.119510e+00
## Recreational_Marijuana 9.173600e-01 9.615700e-01 1.007900e+00
## GSL 9.919600e-01 1.036740e+00 1.083550e+00
## PDMP 9.449600e-01 9.833200e-01 1.023230e+00
## Medicaid_Expansion 1.071320e+00 1.108180e+00 1.146320e+00
## Two Year Intervention Effect 1.026210e+00 1.059240e+00 1.093330e+00
## Number of States w Intervention 9.911800e-01 9.975500e-01 1.003950e+00
## Intercept/Alabama 4.979949e-05 5.901191e-05 6.992854e-05
## standard_error
## Naloxone_Pharmacy_Yes 0.02674000
## Naloxone_Pharmacy_No 0.01965000
## Medical_Marijuana 0.02317000
## Recreational_Marijuana 0.02401000
## GSL 0.02253000
## PDMP 0.02030000
## Medicaid_Expansion 0.01726000
## Two Year Intervention Effect 0.01616000
## Number of States w Intervention 0.00327000
## Intercept/Alabama 0.08659925
#save the table into a CSV
# write.csv(round(sensitivity_anlys_redefine_int_covariate_table, 3), "./Data/coefficients_covariates_1_18_22_full_data_redefine_int.csv")
Attributable Deaths
################ Sensitivity Analysis 4: Number of Attributable Deaths ################
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_redefine_int<-sensitivity_anlys_redefine_int_data[which(sensitivity_anlys_redefine_int_data$int_2_yr_effect>0),]
#compute the probability of overdose had intervention not occurred
prob_od_no_int_redefine_int<-expit(-coef(sensitivity_anlys_redefine_int_model)["int_2_yr_effect"]*
attr_deaths_anlys_redefine_int$int_2_yr_effect
+ logit(attr_deaths_anlys_redefine_int$imputed_deaths/attr_deaths_anlys_redefine_int$population))
#compute the lower and upper bounds of 95% CI of probability of overdose had intervention not occurred
#here, we compute the lower and upper bounds of the 95% CI of all the coefficients using the standard error from the model
coef_lb<-sensitivity_anlys_redefine_int_full_table$lb_coef
coef_ub<-sensitivity_anlys_redefine_int_full_table$ub_coef
names(coef_lb) <- names(coef_ub) <- rownames(sensitivity_anlys_redefine_int_full_table)
#we then calculate the upper and lower bounds of the probability of overdose death had intervention not occurred by using
#the lower and upper bounds of the coefficient of the intervention variable
prob_od_no_int_LB_redefine_int<-expit(-coef_lb[names(coef_lb) == "int_2_yr_effect"]*attr_deaths_anlys_redefine_int$int_2_yr_effect
+ logit(attr_deaths_anlys_redefine_int$imputed_deaths/attr_deaths_anlys_redefine_int$population))
prob_od_no_int_UB_redefine_int<-expit(-coef_ub[names(coef_ub) == "int_2_yr_effect"]*attr_deaths_anlys_redefine_int$int_2_yr_effect
+ logit(attr_deaths_anlys_redefine_int$imputed_deaths/attr_deaths_anlys_redefine_int$population))
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(sensitivity_anlys_redefine_int_data$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths that attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_redefine_int$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_redefine_int$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_redefine_int$imputed_deaths[time_point_index]
- prob_od_no_int_redefine_int[time_point_index]*attr_deaths_anlys_redefine_int$population[time_point_index])
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-sum(attr_deaths_anlys_redefine_int$imputed_deaths[time_point_index]
- prob_od_no_int_LB_redefine_int[time_point_index]*attr_deaths_anlys_redefine_int$population[time_point_index])
num_attr_od_UB[index]<-sum(attr_deaths_anlys_redefine_int$imputed_deaths[time_point_index]
- prob_od_no_int_UB_redefine_int[time_point_index]*attr_deaths_anlys_redefine_int$population[time_point_index])
index<-index + 1
}
num_attr_od_redefine_int<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_redefine_int$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_redefine_int$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_redefine_int$Num_Attr_Deaths)
## [1] 28144.81
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_redefine_int<-num_attr_od_redefine_int %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths),
death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_redefine_int$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 27.8 494.0 1184.5 1407.2 1990.3 3358.7
summary(yearly_num_Attr_Deaths_redefine_int$death_lb)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.67 225.50 540.89 642.64 908.99 1534.10
summary(yearly_num_Attr_Deaths_redefine_int$death_ub)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 42.55 754.52 1808.33 2148.32 3038.24 5126.44
ggplot(yearly_num_Attr_Deaths_redefine_int, aes(x = year, y = deaths)) +
geom_line() +
geom_line(aes(y = death_lb, x = year), linetype = "dashed") +
geom_line(aes(y = death_ub, x = year), linetype = "dashed") +
geom_point()

Sensitivity Analysis 5: Effect of Lagged DIH Prosecutions on Unintentional Overdose Deaths, Assuming Effect Lasts for Two Years
Analysis
############# Sensitivity Analysis 5: Two Year Effect Lagged by 6 months ######################
#create a plot for each state to see how many prosecution media alerts there are per 6 month period
#read in the prosecution media alert data
prosecution_data<-read.csv("./Data/dih_prosecutions_9_6_21.csv")
#data cleaning
#data cleaning
prosecution_data<-prosecution_data %>%
mutate(Date = as.Date(Date.charged, "%m/%d/%Y")) %>%
mutate(State = ifelse(State.Filed == "pennsylvania", "Pennsylvania", State.Filed),
State = ifelse(State.Filed == "Virginia ", "Virginia", State)) %>%
filter(!is.na(Date), State.Filed != "No Info", State.Filed != "No info", State.Filed != "No Info ",
State != "")
#clean up the data by looking at the link to the article
prosecution_data$Date[prosecution_data$Date == "2026-08-01"] <- as.Date("2016-02-15", "%Y-%m-%d")
#change the states into Character instead of factor
prosecution_data$State<-as.character(prosecution_data$State)
#see how many prosecution data points there are for each state
table(prosecution_data$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 76
Colorado Connecticut Delaware Florida Georgia
32 47 3 138 29
Idaho Illinois Indiana Iowa Kansas
9 342 55 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 63 34
Michigan Minnesota Mississippi Missouri Montana
116 140 1 45 11
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 137 4
New York North Carolina North Dakota Ohio Oklahoma
110 124 53 404 41
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 726 2 12 13
Tennessee Texas Utah Vermont Virginia
94 44 21 13 63
Washington West Virginia Wisconsin Wyoming
78 33 381 19
#there are some repeated cases depending on victim
prosecution_data_unique <- prosecution_data %>%
group_by(State) %>%
distinct(Accused.Name, Date, .keep_all = T)
table(prosecution_data_unique$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 72
Colorado Connecticut Delaware Florida Georgia
30 46 3 134 26
Idaho Illinois Indiana Iowa Kansas
9 336 53 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 62 34
Michigan Minnesota Mississippi Missouri Montana
114 140 1 44 10
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 131 4
New York North Carolina North Dakota Ohio Oklahoma
105 121 40 395 34
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 718 2 12 13
Tennessee Texas Utah Vermont Virginia
94 43 21 13 63
Washington West Virginia Wisconsin Wyoming
75 33 373 19
#change date charged into Date object
prosecution_data_unique$Date<-mdy(prosecution_data_unique$Date.charged)
#group the data into six month periods
prosecution_data_unique<-prosecution_data_unique %>%
mutate(six_month_pd = lubridate::floor_date(Date , "6 months" ))
#count the number of prosecution media alerts in each six month period
#we also get the first and last date of prosecution in time period
prosecution_data_by_six_month_pd <- prosecution_data_unique %>%
filter(year(six_month_pd)>1999 & year(six_month_pd)<2020) %>%
group_by(State, six_month_pd) %>%
summarise(first_date_in_pd = min(Date), last_date_in_pd = max(Date))
#create the data set used for this sensitivity analysis
#first, we merge the grouped prosecution data set with the main data set by state and time period
sensitivity_anlys_2yr_int_lag<-merge(main_analysis_data,
prosecution_data_by_six_month_pd,
by.x = c("State", "Time_Period_Start"),
by.y = c("State", "six_month_pd"), all = TRUE)
#create a intervention 2 year effect variable by initializing it to be all 0
sensitivity_anlys_2yr_int_lag<-sensitivity_anlys_2yr_int_lag %>%
group_by(State) %>%
mutate(int_2_yr_effect_lag = 0)
#change the date into a date object
sensitivity_anlys_2yr_int_lag$Time_Period_Start<-as.Date(sensitivity_anlys_2yr_int_lag$Time_Period_Start)
sensitivity_anlys_2yr_int_lag$Time_Period_End<-as.Date(sensitivity_anlys_2yr_int_lag$Time_Period_End)
#we need to calculate the 2 year intervention variable depending on the case
#by examining each row of the data set
for(state in unique(sensitivity_anlys_2yr_int_lag$State)){
#first, subset the data set into state_data which only contains the data for the state
state_index<-which(sensitivity_anlys_2yr_int_lag$State == state)
state_data<-sensitivity_anlys_2yr_int_lag[state_index,]
for(i in 1:(nrow(state_data)-1)){
#for the states that had at least one prosecution in the first 2 years of analysis period,
#we impute the intervention variable based on the intervention variable of main analysis:
#if intervention occurred in time i, then for the 6-month lagged effect, we compute the
#proportion of days affected by intervention, taking into account the 6 month lag. Else,
#if the intervention had occurred by time i, we impute a 1 in the next six-month interval
#since lagged
if(i %in% c(1:4)){
if(state_data$Intervention_Redefined[i] > 0 & state_data$Intervention_Redefined[i] < 1){
state_data$int_2_yr_effect_lag[i + 1] <- as.numeric(state_data$Time_Period_End[i + 1] -
(state_data$first_date_in_pd[i] %m+%
months(6)))/as.numeric(state_data$Time_Period_End[i + 1] -
state_data$Time_Period_Start[i + 1])
}else if(state_data$Intervention_Redefined[i] == 1){
state_data$int_2_yr_effect_lag[i + 1] <- 1
}
#next, if there was at least one prosecution in the last 3 six-month periods (i.e. 1.5 years) before time i
#These rows will be imputed with a 1 in the next six-month interval since lagged
}else if((!is.na(state_data$first_date_in_pd[i - 1]) |
!is.na(state_data$first_date_in_pd[i - 2]) |
!is.na(state_data$first_date_in_pd[i - 3]))){
state_data$int_2_yr_effect_lag[i + 1]<-1
}else{
#next, we account for the rows with the fractions:
# 1) an intervention occurs in row i without an intervention 2 years ago
# 2) row i contains the lasting effects of an intervention that occurred 2 years ago
# 3) row i contains effects from both a new intervention starting in row i and lasting
# effects from 2 years ago
#To compute the fraction, we add the number of days that are affected by an intervention
#(from both the current prosecution and previous prosecution) and then divide by the total
#number of days in the period:
#first, we compute the number of days in the period of time interval i + 1
total_len_of_pd<-as.numeric(state_data$Time_Period_End[i + 1] - state_data$Time_Period_Start[i + 1])
#If there is no prosecution two years ago, i.e. in period i-4, then the last_date is the first
#date in period i + 1. We subtract the last_date by the first date in period i + 1, so we will get
#a 0 for the number of days that are affected by a prosecution from period i-4. Otherwise,
#the last_date is the last date of prosecution from period i-4, plus 2 years.
#The start time is the first date of period i + 1
len_of_past_effect <- ifelse(!is.na(state_data$first_date_in_pd[i - 4]),
as.numeric((as.Date(state_data$last_date_in_pd[i - 4] + years(2),
format = "%Y-%m-%d") %m+% months(6)) -
state_data$Time_Period_Start[i + 1]),
0)
#If there is no prosecution in the period i, then the start_date is the last date in period i + 1 (because lagged effect).
#We subtract start_date from the last date in period i + 1, so we will get a 0 for the number
#of days that are affected by a prosecution in period i. Otherwise, the start_date is the
#first date of a prosecution in period i + 6 months. The end date is the last date in period i + 1.
len_of_current_effect <- ifelse(!is.na(state_data$first_date_in_pd[i]),
as.numeric(state_data$Time_Period_End[i + 1] - (state_data$first_date_in_pd[i] %m+% months(6))),
0)
state_data$int_2_yr_effect_lag[i + 1]<-(len_of_past_effect + len_of_current_effect)/total_len_of_pd
}
}
#for the case where the int_2_yr_effect is greater than 1 (could result when we add the effects of
#previous intervention and the current intervention), we just impute a 1 instead
state_data$int_2_yr_effect_lag[state_data$int_2_yr_effect_lag>1]<-1
#lastly, we store the int_2_yr_effect variable into the sensitivity analysis data set
sensitivity_anlys_2yr_int_lag$int_2_yr_effect_lag[state_index]<-state_data$int_2_yr_effect_lag
}
sensitivity_anlys_2yr_int_lag <- sensitivity_anlys_2yr_int_lag %>%
group_by(Time_Period_Start) %>%
mutate(num_states_w_intervention_2yr_lag = sum(int_2_yr_effect_lag))
#view the data set just to make sure the imputation looks right
# View(sensitivity_anlys_2yr_int_lag %>% select(State, Time_Period_Start, Time_Period_End,
# Intervention_Redefined, first_date_in_pd,
# last_date_in_pd,
# int_2_yr_effect_lag))
#run the analysis for all the states
lagged_analysis_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
int_2_yr_effect_lag +
num_states_w_intervention_2yr_lag,
data = sensitivity_anlys_2yr_int_lag, family = "binomial")
#summary output of the model
stargazer(lagged_analysis_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.259***
|
|
|
(0.028)
|
|
|
|
|
StateArizona
|
0.310***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.382***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.153***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.087***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.183***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.414***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.256***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.056***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.253***
|
|
|
(0.025)
|
|
|
|
|
StateIdaho
|
-0.149***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.015
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.083***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.737***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.315***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.633***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.297***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.143***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.062***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.209***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.022
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.623***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.102***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.199***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.352***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.875***
|
|
|
(0.029)
|
|
|
|
|
StateNevada
|
0.444***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.251***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.112***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.634***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.242***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.180***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.061***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.457***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.379***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.202***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.436***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.237***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.209***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-0.973***
|
|
|
(0.043)
|
|
|
|
|
StateTennessee
|
0.442***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.195***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.080***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.164***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.109***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.069***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.866***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.035**
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.022
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.027***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.005
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.066***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.039***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.034***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.018***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.102***
|
|
|
(0.006)
|
|
|
|
|
int_2_yr_effect_lag
|
0.036***
|
|
|
(0.005)
|
|
|
|
|
num_states_w_intervention_2yr_lag
|
0.0001
|
|
|
(0.001)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.787***
|
|
|
(0.030)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.911
|
|
Log Likelihood
|
-16,792.500
|
|
UBRE
|
8.882
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
lagged_analysis_model_w_basis_functions <- data.frame(predict(lagged_analysis_model, type = "lpmatrix"))
#estimate the 95% CI and SD
lagged_analysis_model_coefficient_values <- coef(lagged_analysis_model)
#type = "response" to get the estimated probabilities
lagged_analysis_model_pred_prob <- predict(lagged_analysis_model,
newdata = sensitivity_anlys_2yr_int_lag, type = "response")
lagged_analysis_model_sd_and_ci <- compute_sd_and_CI(lagged_analysis_model_w_basis_functions,
sensitivity_anlys_2yr_int_lag$population,
sensitivity_anlys_2yr_int_lag$imputed_deaths,
lagged_analysis_model_pred_prob,
lagged_analysis_model_coefficient_values)
lagged_analysis_model_sd_and_ci
## lb_coef coef_values
## (Intercept) -9.978791478 -9.7871037272
## StateAlaska 0.158519988 0.2589151805
## StateArizona 0.237687504 0.3095838419
## StateArkansas -0.473304718 -0.3822331360
## StateCalifornia -0.236005426 -0.1531455869
## StateColorado 0.003235339 0.0868216582
## StateConnecticut 0.100216998 0.1832170594
## StateDelaware 0.281849090 0.4139376130
## StateFlorida 0.179016844 0.2556464611
## StateGeorgia -0.121947567 -0.0555563712
## StateHawaii -0.353212571 -0.2530856744
## StateIdaho -0.237681993 -0.1493432478
## StateIllinois -0.103143517 -0.0150047044
## StateIndiana 0.011633767 0.0832693028
## StateIowa -0.823071786 -0.7368584237
## StateKansas -0.411457670 -0.3153654817
## StateKentucky 0.560143510 0.6326881933
## StateLouisiana 0.224263675 0.2971590360
## StateMaine 0.045621644 0.1426560308
## StateMaryland -1.275279901 -1.0622431221
## StateMassachusetts 0.103985505 0.2085458828
## StateMichigan -0.095252392 -0.0216558633
## StateMinnesota -0.706414212 -0.6232634692
## StateMississippi -0.179427075 -0.1018467292
## StateMissouri 0.122135313 0.1986898241
## StateMontana -0.443355994 -0.3520532671
## StateNebraska -0.970089815 -0.8750627128
## StateNevada 0.357755130 0.4441405001
## StateNew Hampshire 0.163576492 0.2513961258
## StateNew Jersey 0.014170667 0.1123349165
## StateNew Mexico 0.546482122 0.6335281885
## StateNew York -0.316767198 -0.2418462781
## StateNorth Carolina 0.113064184 0.1796881742
## StateNorth Dakota -1.180618999 -1.0610469823
## StateOhio 0.374696171 0.4569945189
## StateOklahoma 0.278070028 0.3786439492
## StateOregon -0.287543435 -0.2017726083
## StatePennsylvania 0.365288171 0.4364270522
## StateRhode Island 0.119380205 0.2374380943
## StateSouth Carolina 0.141475178 0.2086201634
## StateSouth Dakota -1.071655275 -0.9731139425
## StateTennessee 0.373804490 0.4422550773
## StateTexas -0.270791209 -0.1947324935
## StateUtah -0.054491143 0.0802948661
## StateVermont -0.258754874 -0.1644303842
## StateVirginia -0.189144702 -0.1093659537
## StateWashington -0.020708674 0.0687506741
## StateWest Virginia 0.768624755 0.8655142944
## StateWisconsin -0.100831905 -0.0352517836
## StateWyoming -0.092392075 0.0223101291
## Naloxone_Pharmacy_Yes_Redefined -0.079561774 -0.0274129394
## Naloxone_Pharmacy_No_Redefined -0.033060044 0.0054038262
## Medical_Marijuana_Redefined 0.020323970 0.0657051369
## Recreational_Marijuana_Redefined -0.086826253 -0.0391883881
## GSL_Redefined -0.010602110 0.0338272491
## PDMP_Redefined -0.057721761 -0.0177780983
## Medicaid_Expansion_Redefined 0.068258330 0.1020424949
## int_2_yr_effect_lag 0.005131920 0.0356919950
## num_states_w_intervention_2yr_lag -0.007589059 0.0001099579
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.561233211 -0.3810649729
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.291210988 -0.1674685340
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.084892977 0.1944091544
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.114894496 0.2310732604
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.252454449 0.3867389040
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.342918254 0.4968284235
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.488805440 0.6878878881
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.791601026 1.0355120425
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.584102194 0.7996849640
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.548088375 -0.3521233643
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.420957047 -0.2744262258
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.048277475 0.1614958496
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.093465482 0.0202828140
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.030224875 0.1661276739
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.186004297 0.3394456748
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.423232051 0.6224601037
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.805742439 1.0402175728
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.581740570 0.8104792966
## s(Time_Period_ID):as.factor(Region)South.1 -0.287145402 -0.1703475472
## s(Time_Period_ID):as.factor(Region)South.2 -0.080293626 0.0067404758
## s(Time_Period_ID):as.factor(Region)South.3 0.187459288 0.2481607491
## s(Time_Period_ID):as.factor(Region)South.4 0.231601461 0.2874642614
## s(Time_Period_ID):as.factor(Region)South.5 0.260445524 0.3707171012
## s(Time_Period_ID):as.factor(Region)South.6 0.195835204 0.3322483669
## s(Time_Period_ID):as.factor(Region)South.7 0.350475409 0.5275088773
## s(Time_Period_ID):as.factor(Region)South.8 0.596468493 0.8159095451
## s(Time_Period_ID):as.factor(Region)South.9 0.418055305 0.6319341892
## s(Time_Period_ID):as.factor(Region)West.1 -0.343360692 -0.1583955410
## s(Time_Period_ID):as.factor(Region)West.2 -0.073357966 0.0482273391
## s(Time_Period_ID):as.factor(Region)West.3 0.063841186 0.1800667882
## s(Time_Period_ID):as.factor(Region)West.4 0.151995191 0.2589999821
## s(Time_Period_ID):as.factor(Region)West.5 0.095893923 0.2418414167
## s(Time_Period_ID):as.factor(Region)West.6 0.075516753 0.2408126598
## s(Time_Period_ID):as.factor(Region)West.7 0.098462042 0.3008424802
## s(Time_Period_ID):as.factor(Region)West.8 0.184479402 0.4279614589
## s(Time_Period_ID):as.factor(Region)West.9 0.295228663 0.5172421638
## ub_coef exp_lb
## (Intercept) -9.595415977 4.637308e-05
## StateAlaska 0.359310373 1.171775e+00
## StateArizona 0.381480180 1.268313e+00
## StateArkansas -0.291161554 6.229402e-01
## StateCalifornia -0.070285748 7.897764e-01
## StateColorado 0.170407978 1.003241e+00
## StateConnecticut 0.266217120 1.105411e+00
## StateDelaware 0.546026136 1.325579e+00
## StateFlorida 0.332276078 1.196041e+00
## StateGeorgia 0.010834825 8.851948e-01
## StateHawaii -0.152958777 7.024279e-01
## StateIdaho -0.061004502 7.884534e-01
## StateIllinois 0.073134108 9.019975e-01
## StateIndiana 0.154904839 1.011702e+00
## StateIowa -0.650645062 4.390808e-01
## StateKansas -0.219273294 6.626836e-01
## StateKentucky 0.705232876 1.750924e+00
## StateLouisiana 0.370054397 1.251401e+00
## StateMaine 0.239690418 1.046678e+00
## StateMaryland -0.849206343 2.793528e-01
## StateMassachusetts 0.313106261 1.109584e+00
## StateMichigan 0.051940665 9.091434e-01
## StateMinnesota -0.540112727 4.934103e-01
## StateMississippi -0.024266384 8.357489e-01
## StateMissouri 0.275244335 1.129907e+00
## StateMontana -0.260750541 6.418787e-01
## StateNebraska -0.780035611 3.790490e-01
## StateNevada 0.530525870 1.430115e+00
## StateNew Hampshire 0.339215759 1.177715e+00
## StateNew Jersey 0.210499166 1.014272e+00
## StateNew Mexico 0.720574255 1.727166e+00
## StateNew York -0.166925359 7.285003e-01
## StateNorth Carolina 0.246312165 1.119704e+00
## StateNorth Dakota -0.941474965 3.070886e-01
## StateOhio 0.539292867 1.454549e+00
## StateOklahoma 0.479217871 1.320579e+00
## StateOregon -0.116001782 7.501040e-01
## StatePennsylvania 0.507565934 1.440929e+00
## StateRhode Island 0.355495984 1.126798e+00
## StateSouth Carolina 0.275765149 1.151972e+00
## StateSouth Dakota -0.874572610 3.424412e-01
## StateTennessee 0.510705664 1.453253e+00
## StateTexas -0.118673778 7.627757e-01
## StateUtah 0.215080875 9.469669e-01
## StateVermont -0.070105894 7.720122e-01
## StateVirginia -0.029587205 8.276667e-01
## StateWashington 0.158210022 9.795043e-01
## StateWest Virginia 0.962403834 2.156798e+00
## StateWisconsin 0.030328337 9.040850e-01
## StateWyoming 0.137012333 9.117476e-01
## Naloxone_Pharmacy_Yes_Redefined 0.024735895 9.235210e-01
## Naloxone_Pharmacy_No_Redefined 0.043867696 9.674805e-01
## Medical_Marijuana_Redefined 0.111086304 1.020532e+00
## Recreational_Marijuana_Redefined 0.008449477 9.168364e-01
## GSL_Redefined 0.078256608 9.894539e-01
## PDMP_Redefined 0.022165564 9.439125e-01
## Medicaid_Expansion_Redefined 0.135826660 1.070642e+00
## int_2_yr_effect_lag 0.066252070 1.005145e+00
## num_states_w_intervention_2yr_lag 0.007808975 9.924397e-01
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.200896735 5.705051e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.043726080 7.473580e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.303925332 1.088601e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.347252024 1.121755e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.521023359 1.287181e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.650738592 1.409054e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.886970336 1.630367e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.279423059 2.206927e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.015267734 1.793380e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.156158353 5.780538e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.127895405 6.564183e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.274714224 1.049462e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.134031110 9.107695e-01
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.302030473 1.030686e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.492887053 1.204427e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.821688156 1.526889e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.274692706 2.238358e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.039218024 1.789150e+00
## s(Time_Period_ID):as.factor(Region)South.1 -0.053549693 7.504026e-01
## s(Time_Period_ID):as.factor(Region)South.2 0.093774577 9.228453e-01
## s(Time_Period_ID):as.factor(Region)South.3 0.308862211 1.206181e+00
## s(Time_Period_ID):as.factor(Region)South.4 0.343327062 1.260617e+00
## s(Time_Period_ID):as.factor(Region)South.5 0.480988679 1.297508e+00
## s(Time_Period_ID):as.factor(Region)South.6 0.468661530 1.216326e+00
## s(Time_Period_ID):as.factor(Region)South.7 0.704542346 1.419742e+00
## s(Time_Period_ID):as.factor(Region)South.8 1.035350597 1.815695e+00
## s(Time_Period_ID):as.factor(Region)South.9 0.845813073 1.519005e+00
## s(Time_Period_ID):as.factor(Region)West.1 0.026569610 7.093823e-01
## s(Time_Period_ID):as.factor(Region)West.2 0.169812644 9.292681e-01
## s(Time_Period_ID):as.factor(Region)West.3 0.296292391 1.065923e+00
## s(Time_Period_ID):as.factor(Region)West.4 0.366004773 1.164155e+00
## s(Time_Period_ID):as.factor(Region)West.5 0.387788911 1.100642e+00
## s(Time_Period_ID):as.factor(Region)West.6 0.406108567 1.078441e+00
## s(Time_Period_ID):as.factor(Region)West.7 0.503222918 1.103473e+00
## s(Time_Period_ID):as.factor(Region)West.8 0.671443516 1.202592e+00
## s(Time_Period_ID):as.factor(Region)West.9 0.739255665 1.343434e+00
## exp_coef exp_ub
## (Intercept) 5.617135e-05 6.803992e-05
## StateAlaska 1.295524e+00 1.432341e+00
## StateArizona 1.362858e+00 1.464451e+00
## StateArkansas 6.823360e-01 7.473949e-01
## StateCalifornia 8.580048e-01 9.321274e-01
## StateColorado 1.090702e+00 1.185789e+00
## StateConnecticut 1.201075e+00 1.305018e+00
## StateDelaware 1.512763e+00 1.726379e+00
## StateFlorida 1.291296e+00 1.394138e+00
## StateGeorgia 9.459587e-01 1.010894e+00
## StateHawaii 7.764014e-01 8.581651e-01
## StateIdaho 8.612734e-01 9.408190e-01
## StateIllinois 9.851073e-01 1.075875e+00
## StateIndiana 1.086834e+00 1.167547e+00
## StateIowa 4.786152e-01 5.217091e-01
## StateKansas 7.295222e-01 8.031022e-01
## StateKentucky 1.882665e+00 2.024318e+00
## StateLouisiana 1.346029e+00 1.447813e+00
## StateMaine 1.153333e+00 1.270856e+00
## StateMaryland 3.456795e-01 4.277543e-01
## StateMassachusetts 1.231885e+00 1.367667e+00
## StateMichigan 9.785769e-01 1.053313e+00
## StateMinnesota 5.361917e-01 5.826826e-01
## StateMississippi 9.031680e-01 9.760257e-01
## StateMissouri 1.219804e+00 1.316852e+00
## StateMontana 7.032427e-01 7.704731e-01
## StateNebraska 4.168359e-01 4.583897e-01
## StateNevada 1.559150e+00 1.699826e+00
## StateNew Hampshire 1.285819e+00 1.403846e+00
## StateNew Jersey 1.118888e+00 1.234294e+00
## StateNew Mexico 1.884247e+00 2.055613e+00
## StateNew York 7.851769e-01 8.462628e-01
## StateNorth Carolina 1.196844e+00 1.279299e+00
## StateNorth Dakota 3.460933e-01 3.900521e-01
## StateOhio 1.579320e+00 1.714794e+00
## StateOklahoma 1.460303e+00 1.614811e+00
## StateOregon 8.172807e-01 8.904736e-01
## StatePennsylvania 1.547169e+00 1.661243e+00
## StateRhode Island 1.267996e+00 1.426888e+00
## StateSouth Carolina 1.231977e+00 1.317538e+00
## StateSouth Dakota 3.779044e-01 4.170402e-01
## StateTennessee 1.556213e+00 1.666467e+00
## StateTexas 8.230548e-01 8.880975e-01
## StateUtah 1.083607e+00 1.239962e+00
## StateVermont 8.483768e-01 9.322951e-01
## StateVirginia 8.964023e-01 9.708462e-01
## StateWashington 1.071169e+00 1.171412e+00
## StateWest Virginia 2.376228e+00 2.617982e+00
## StateWisconsin 9.653623e-01 1.030793e+00
## StateWyoming 1.022561e+00 1.146842e+00
## Naloxone_Pharmacy_Yes_Redefined 9.729594e-01 1.025044e+00
## Naloxone_Pharmacy_No_Redefined 1.005418e+00 1.044844e+00
## Medical_Marijuana_Redefined 1.067912e+00 1.117491e+00
## Recreational_Marijuana_Redefined 9.615695e-01 1.008485e+00
## GSL_Redefined 1.034406e+00 1.081400e+00
## PDMP_Redefined 9.823790e-01 1.022413e+00
## Medicaid_Expansion_Redefined 1.107431e+00 1.145483e+00
## int_2_yr_effect_lag 1.036337e+00 1.068496e+00
## num_states_w_intervention_2yr_lag 1.000110e+00 1.007840e+00
## s(Time_Period_ID):as.factor(Region)Midwest.1 6.831335e-01 8.179969e-01
## s(Time_Period_ID):as.factor(Region)Midwest.2 8.458032e-01 9.572161e-01
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.214593e+00 1.355168e+00
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.259952e+00 1.415173e+00
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.472172e+00 1.683750e+00
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.643501e+00 1.916956e+00
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.989509e+00 2.427763e+00
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.816548e+00 3.594565e+00
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.224840e+00 2.760102e+00
## s(Time_Period_ID):as.factor(Region)Northeast.1 7.031934e-01 8.554237e-01
## s(Time_Period_ID):as.factor(Region)Northeast.2 7.600081e-01 8.799454e-01
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.175268e+00 1.316154e+00
## s(Time_Period_ID):as.factor(Region)Northeast.4 1.020490e+00 1.143428e+00
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.180724e+00 1.352602e+00
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.404169e+00 1.637036e+00
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.863507e+00 2.274336e+00
## s(Time_Period_ID):as.factor(Region)Northeast.8 2.829833e+00 3.577602e+00
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.248986e+00 2.827005e+00
## s(Time_Period_ID):as.factor(Region)South.1 8.433717e-01 9.478588e-01
## s(Time_Period_ID):as.factor(Region)South.2 1.006763e+00 1.098312e+00
## s(Time_Period_ID):as.factor(Region)South.3 1.281666e+00 1.361875e+00
## s(Time_Period_ID):as.factor(Region)South.4 1.333043e+00 1.409630e+00
## s(Time_Period_ID):as.factor(Region)South.5 1.448773e+00 1.617673e+00
## s(Time_Period_ID):as.factor(Region)South.6 1.394099e+00 1.597854e+00
## s(Time_Period_ID):as.factor(Region)South.7 1.694705e+00 2.022921e+00
## s(Time_Period_ID):as.factor(Region)South.8 2.261231e+00 2.816093e+00
## s(Time_Period_ID):as.factor(Region)South.9 1.881246e+00 2.329871e+00
## s(Time_Period_ID):as.factor(Region)West.1 8.535121e-01 1.026926e+00
## s(Time_Period_ID):as.factor(Region)West.2 1.049409e+00 1.185083e+00
## s(Time_Period_ID):as.factor(Region)West.3 1.197297e+00 1.344863e+00
## s(Time_Period_ID):as.factor(Region)West.4 1.295634e+00 1.441962e+00
## s(Time_Period_ID):as.factor(Region)West.5 1.273592e+00 1.473719e+00
## s(Time_Period_ID):as.factor(Region)West.6 1.272283e+00 1.500965e+00
## s(Time_Period_ID):as.factor(Region)West.7 1.350997e+00 1.654044e+00
## s(Time_Period_ID):as.factor(Region)West.8 1.534127e+00 1.957060e+00
## s(Time_Period_ID):as.factor(Region)West.9 1.677395e+00 2.094376e+00
## sd_coef
## (Intercept) 0.09779987
## StateAlaska 0.05122204
## StateArizona 0.03668181
## StateArkansas 0.04646509
## StateCalifornia 0.04227543
## StateColorado 0.04264608
## StateConnecticut 0.04234697
## StateDelaware 0.06739210
## StateFlorida 0.03909674
## StateGeorgia 0.03387306
## StateHawaii 0.05108515
## StateIdaho 0.04507079
## StateIllinois 0.04496878
## StateIndiana 0.03654874
## StateIowa 0.04398641
## StateKansas 0.04902663
## StateKentucky 0.03701259
## StateLouisiana 0.03719151
## StateMaine 0.04950734
## StateMaryland 0.10869223
## StateMassachusetts 0.05334713
## StateMichigan 0.03754925
## StateMinnesota 0.04242385
## StateMississippi 0.03958181
## StateMissouri 0.03905842
## StateMontana 0.04658302
## StateNebraska 0.04848322
## StateNevada 0.04407417
## StateNew Hampshire 0.04480594
## StateNew Jersey 0.05008380
## StateNew Mexico 0.04441126
## StateNew York 0.03822496
## StateNorth Carolina 0.03399183
## StateNorth Dakota 0.06100613
## StateOhio 0.04198895
## StateOklahoma 0.05131323
## StateOregon 0.04376063
## StatePennsylvania 0.03629535
## StateRhode Island 0.06023362
## StateSouth Carolina 0.03425765
## StateSouth Dakota 0.05027619
## StateTennessee 0.03492377
## StateTexas 0.03880547
## StateUtah 0.06876837
## StateVermont 0.04812474
## StateVirginia 0.04070344
## StateWashington 0.04564252
## StateWest Virginia 0.04943344
## StateWisconsin 0.03345925
## StateWyoming 0.05852153
## Naloxone_Pharmacy_Yes_Redefined 0.02660655
## Naloxone_Pharmacy_No_Redefined 0.01962442
## Medical_Marijuana_Redefined 0.02315366
## Recreational_Marijuana_Redefined 0.02430503
## GSL_Redefined 0.02266804
## PDMP_Redefined 0.02037942
## Medicaid_Expansion_Redefined 0.01723682
## int_2_yr_effect_lag 0.01559187
## num_states_w_intervention_2yr_lag 0.00392807
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.09192257
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.06313391
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.05587560
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.05927488
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.06851248
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.07852560
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.10157268
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.12444440
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.10999121
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.09998215
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.07476062
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.05776448
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.05803484
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.06933816
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.07828642
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.10164697
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.11963017
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.11670343
## s(Time_Period_ID):as.factor(Region)South.1 0.05959074
## s(Time_Period_ID):as.factor(Region)South.2 0.04440515
## s(Time_Period_ID):as.factor(Region)South.3 0.03097013
## s(Time_Period_ID):as.factor(Region)South.4 0.02850143
## s(Time_Period_ID):as.factor(Region)South.5 0.05626101
## s(Time_Period_ID):as.factor(Region)South.6 0.06959855
## s(Time_Period_ID):as.factor(Region)South.7 0.09032320
## s(Time_Period_ID):as.factor(Region)South.8 0.11195972
## s(Time_Period_ID):as.factor(Region)South.9 0.10912188
## s(Time_Period_ID):as.factor(Region)West.1 0.09436998
## s(Time_Period_ID):as.factor(Region)West.2 0.06203332
## s(Time_Period_ID):as.factor(Region)West.3 0.05929878
## s(Time_Period_ID):as.factor(Region)West.4 0.05459428
## s(Time_Period_ID):as.factor(Region)West.5 0.07446301
## s(Time_Period_ID):as.factor(Region)West.6 0.08433465
## s(Time_Period_ID):as.factor(Region)West.7 0.10325533
## s(Time_Period_ID):as.factor(Region)West.8 0.12422554
## s(Time_Period_ID):as.factor(Region)West.9 0.11327219
Plots
gam.check(lagged_analysis_model)

##
## Method: UBRE Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-7.10661e-07,2.358126e-05]
## (score 8.881691 & scale 1).
## Hessian positive definite, eigenvalue range [8.779527e-05,0.0005068349].
## Model rank = 95 / 95
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(Time_Period_ID):as.factor(Region)Midwest 9.00 8.88 1.05 0.99
## s(Time_Period_ID):as.factor(Region)Northeast 9.00 8.95 1.05 0.97
## s(Time_Period_ID):as.factor(Region)South 9.00 8.92 1.05 0.98
## s(Time_Period_ID):as.factor(Region)West 9.00 7.88 1.05 0.99
Compile Results
############## Sensitivity Analysis 5: Make Data Frame of Results and 95% CI ###########
#store the coefficients into the table
sensitivity_anlys_2yr_int_lag_full_table<-lagged_analysis_model_sd_and_ci
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"int_2_yr_effect_lag",
"num_states_w_intervention_2yr_lag")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_2yr_int_lag_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_2yr_int_lag_full_table)[i]<-substr(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i], start = 6,
stop = nchar(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i]))
}else if(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_2yr_int_lag_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_2yr_int_lag_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i],
start = 36,
stop = nchar(rownames(sensitivity_anlys_2yr_int_lag_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_2yr_int_lag_full_table)
## lb_coef coef_values ub_coef exp_lb
## Intercept/Alabama -9.978791478 -9.78710373 -9.59541598 4.637308e-05
## Alaska 0.158519988 0.25891518 0.35931037 1.171775e+00
## Arizona 0.237687504 0.30958384 0.38148018 1.268313e+00
## Arkansas -0.473304718 -0.38223314 -0.29116155 6.229402e-01
## California -0.236005426 -0.15314559 -0.07028575 7.897764e-01
## Colorado 0.003235339 0.08682166 0.17040798 1.003241e+00
## exp_coef exp_ub sd_coef
## Intercept/Alabama 5.617135e-05 6.803992e-05 0.09779987
## Alaska 1.295524e+00 1.432341e+00 0.05122204
## Arizona 1.362858e+00 1.464451e+00 0.03668181
## Arkansas 6.823360e-01 7.473949e-01 0.04646509
## California 8.580048e-01 9.321274e-01 0.04227543
## Colorado 1.090702e+00 1.185789e+00 0.04264608
tail(sensitivity_anlys_2yr_int_lag_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.15199519 0.2590000 0.3660048 1.164155
## Smoothed Time for Region West.5 0.09589392 0.2418414 0.3877889 1.100642
## Smoothed Time for Region West.6 0.07551675 0.2408127 0.4061086 1.078441
## Smoothed Time for Region West.7 0.09846204 0.3008425 0.5032229 1.103473
## Smoothed Time for Region West.8 0.18447940 0.4279615 0.6714435 1.202592
## Smoothed Time for Region West.9 0.29522866 0.5172422 0.7392557 1.343434
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.295634 1.441962 0.05459428
## Smoothed Time for Region West.5 1.273592 1.473719 0.07446301
## Smoothed Time for Region West.6 1.272283 1.500965 0.08433465
## Smoothed Time for Region West.7 1.350997 1.654044 0.10325533
## Smoothed Time for Region West.8 1.534127 1.957060 0.12422554
## Smoothed Time for Region West.9 1.677395 2.094376 0.11327219
#save the table into a CSV
# write.csv(round(sensitivity_anlys_2yr_int_lag_full_table,5), "./Data/coefficients_GAM_9_6_21_lagged_2yr_int.csv")
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(sensitivity_anlys_2yr_int_lag_full_table) %in% covariates)
sens_analysis_2yr_int_lag_covariate_table<-(round(sensitivity_anlys_2yr_int_lag_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(sens_analysis_2yr_int_lag_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Intervention",
"Number of States w Intervention")
#now, reorganize the data so that the covariates are on top and the rest of the variable sare below
sens_analysis_2yr_int_lag_covariate_table<-rbind(sens_analysis_2yr_int_lag_covariate_table, sensitivity_anlys_2yr_int_lag_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
sens_analysis_2yr_int_lag_covariate_table<-sens_analysis_2yr_int_lag_covariate_table[,-which(colnames(sens_analysis_2yr_int_lag_covariate_table) %in%
c("lb_coef", "coef_values",
"ub_coef"))]
colnames(sens_analysis_2yr_int_lag_covariate_table)<-c("RR_95_CI_LB", "Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(sens_analysis_2yr_int_lag_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates RR_95_CI_UB
## Naloxone_Pharmacy_Yes 9.235200e-01 9.729600e-01 1.025040e+00
## Naloxone_Pharmacy_No 9.674800e-01 1.005420e+00 1.044840e+00
## Medical_Marijuana 1.020530e+00 1.067910e+00 1.117490e+00
## Recreational_Marijuana 9.168400e-01 9.615700e-01 1.008490e+00
## GSL 9.894500e-01 1.034410e+00 1.081400e+00
## PDMP 9.439100e-01 9.823800e-01 1.022410e+00
## Medicaid_Expansion 1.070640e+00 1.107430e+00 1.145480e+00
## Intervention 1.005150e+00 1.036340e+00 1.068500e+00
## Number of States w Intervention 9.924400e-01 1.000110e+00 1.007840e+00
## Intercept/Alabama 4.637308e-05 5.617135e-05 6.803992e-05
## standard_error
## Naloxone_Pharmacy_Yes 0.02661000
## Naloxone_Pharmacy_No 0.01962000
## Medical_Marijuana 0.02315000
## Recreational_Marijuana 0.02431000
## GSL 0.02267000
## PDMP 0.02038000
## Medicaid_Expansion 0.01724000
## Intervention 0.01559000
## Number of States w Intervention 0.00393000
## Intercept/Alabama 0.09779987
#save the table into a CSV
# write.csv(round(sens_analysis_2yr_int_lag_covariate_table, 3), "./Data/coefficients_covariates_1_18_22_2_yr_int_lag.csv")
Attributable Deaths
################# Sensitivity Analysis 5: Number of Attributable Deaths #################
#find the number of deaths attributable to the intervention
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_2yr_int_lag<-sensitivity_anlys_2yr_int_lag[which(sensitivity_anlys_2yr_int_lag$int_2_yr_effect_lag>0),]
#compute the probability of overdose had intervention not occurred
prob_od_no_int_2yr_int_lag<-expit(-coef(lagged_analysis_model)["int_2_yr_effect_lag"]
+ logit(attr_deaths_anlys_2yr_int_lag$imputed_deaths/attr_deaths_anlys_2yr_int_lag$population))
#compute the lower and upper bounds of 95% CI of probability of overdose had intervention not occurred
#here, we compute the lower and upper bounds of the 95% CI of all the coefficients using the standard error from the model
coef_lb<-sensitivity_anlys_2yr_int_lag_full_table$lb_coef
coef_ub<-sensitivity_anlys_2yr_int_lag_full_table$ub_coef
names(coef_lb) <- names(coef_ub) <- rownames(sensitivity_anlys_2yr_int_lag_full_table)
#we then calculate the upper and lower bounds of the probability of overdose death had intervention not occurred by using
#the lower and upper bounds of the coefficient of the intervention variable
prob_od_no_int_LB_2yr_int_lag<-expit(-coef_lb[names(coef_lb) == "int_2_yr_effect_lag"]
+ logit(attr_deaths_anlys_2yr_int_lag$imputed_deaths/attr_deaths_anlys_2yr_int_lag$population))
prob_od_no_int_UB_2yr_int_lag<-expit(-coef_ub[names(coef_ub) == "int_2_yr_effect_lag"]
+ logit(attr_deaths_anlys_2yr_int_lag$imputed_deaths/attr_deaths_anlys_2yr_int_lag$population))
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(attr_deaths_anlys_2yr_int_lag$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_2yr_int_lag$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_2yr_int_lag$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_2yr_int_lag$imputed_deaths[time_point_index]
- prob_od_no_int_2yr_int_lag[time_point_index]*attr_deaths_anlys_2yr_int_lag$population[time_point_index])
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-sum(attr_deaths_anlys_2yr_int_lag$imputed_deaths[time_point_index]
- prob_od_no_int_LB_2yr_int_lag[time_point_index]*attr_deaths_anlys_2yr_int_lag$population[time_point_index])
num_attr_od_UB[index]<-sum(attr_deaths_anlys_2yr_int_lag$imputed_deaths[time_point_index]
- prob_od_no_int_UB_2yr_int_lag[time_point_index]*attr_deaths_anlys_2yr_int_lag$population[time_point_index])
index<-index + 1
}
num_attr_od_2yr_int_lag<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_2yr_int_lag$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_2yr_int_lag$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_2yr_int_lag$Num_Attr_Deaths)
## [1] 17799.01
summary(num_attr_od_2yr_int_lag$Num_Attr_Deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 11.61 165.88 389.67 456.38 654.51 1106.00
num_attr_od_2yr_int_lag$Time_Start<-as.Date(num_attr_od_2yr_int_lag$Time_Start)
#compute the 95% CI for the total
sum(num_attr_od_2yr_int_lag$Num_Attr_Deaths_LB)
## [1] 2598.466
sum(num_attr_od_2yr_int_lag$Num_Attr_Deaths_UB)
## [1] 32542.14
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_2yr_int_lag<-num_attr_od_2yr_int_lag %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths), death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_2yr_int_lag$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 11.61 305.94 746.89 889.95 1264.13 2107.53
summary(yearly_num_Attr_Deaths_2yr_int_lag$death_lb)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.694 44.664 109.037 129.923 184.550 307.677
summary(yearly_num_Attr_Deaths_2yr_int_lag$death_ub)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 21.22 559.35 1365.54 1627.11 2311.22 3853.23
ggplot(yearly_num_Attr_Deaths_2yr_int_lag, aes(x = year, y = deaths)) + geom_line() + geom_point()

Compile Attributable Deaths Results
########################## Compiled Attributable Deaths Plot###############################
#add color column to the datasets
yearly_num_Attr_Deaths_main_analysis <- yearly_num_Attr_Deaths_main_analysis %>%
mutate(gp_type = "a")
yearly_num_Attr_Deaths_exclude_states <- yearly_num_Attr_Deaths_exclude_states %>%
mutate(gp_type = "c")
# yearly_num_Attr_Deaths_od_all <- yearly_num_Attr_Deaths_od_all %>%
# mutate(gp_type = "b")
yearly_num_Attr_Deaths_redefine_int <- yearly_num_Attr_Deaths_redefine_int %>%
mutate(gp_type = "d")
# pdf("Figures/num_attr_deaths_yearly_for_all_anlys_1_18_22_all_od_shape_alpha.pdf")
ggplot(yearly_num_Attr_Deaths_main_analysis) +
geom_line(aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1, color = gp_type,
linetype = "Estimate")) +
geom_point(aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1, color = gp_type, shape = gp_type)) +
geom_line(yearly_num_Attr_Deaths_main_analysis,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
color = gp_type, linetype = "95% Confidence Interval")) +
geom_line(yearly_num_Attr_Deaths_main_analysis,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
color =gp_type,linetype = "95% Confidence Interval")) +
# geom_point(yearly_num_Attr_Deaths_main_analysis,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
# color = "a")) +
# geom_point(yearly_num_Attr_Deaths_main_analysis,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
# color ="a")) +
geom_line(yearly_num_Attr_Deaths_redefine_int,
mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
color = gp_type, linetype = "Estimate")) +
geom_point(yearly_num_Attr_Deaths_redefine_int,
mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
color = gp_type, shape = gp_type)) +
geom_line(yearly_num_Attr_Deaths_redefine_int,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
color = gp_type, linetype = "95% Confidence Interval")) +
geom_line(yearly_num_Attr_Deaths_redefine_int,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
color = gp_type, linetype = "95% Confidence Interval")) +
# geom_point(yearly_num_Attr_Deaths_redefine_int,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
# color = "d")) +
# geom_point(yearly_num_Attr_Deaths_redefine_int,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
# color = "d")) +
# geom_line(yearly_num_Attr_Deaths_od_all, mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
# color = gp_type, linetype = "Estimate"), alpha = 1) +
# geom_point(yearly_num_Attr_Deaths_od_all, mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
# color = gp_type, shape = gp_type), alpha = 1) +
# geom_line(yearly_num_Attr_Deaths_od_all,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
# color = gp_type, linetype = "95% Confidence Interval"), alpha = 1) +
# geom_line(yearly_num_Attr_Deaths_od_all,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
# color = gp_type, linetype = "95% Confidence Interval"), alpha = 1) +
# geom_point(yearly_num_Attr_Deaths_od_all,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
# color = "b"), alpha = 0.5) +
# geom_point(yearly_num_Attr_Deaths_od_all,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
# color = "b") , alpha = 0.5) +
geom_line(yearly_num_Attr_Deaths_exclude_states,
mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
color = gp_type, linetype = "Estimate"), alpha = 1) +
geom_point(yearly_num_Attr_Deaths_exclude_states, mapping = aes(x = as.Date(as.yearmon(year)), y = deaths, group = 1,
color = gp_type, shape = gp_type), alpha = 1) +
geom_line(yearly_num_Attr_Deaths_exclude_states,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
color = gp_type, linetype = "95% Confidence Interval"),alpha = 1) +
geom_line(yearly_num_Attr_Deaths_exclude_states,
mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
color = gp_type, linetype = "95% Confidence Interval"), alpha = 1) +
# geom_point(yearly_num_Attr_Deaths_exclude_states,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_ub, group = 1,
# color = "c"),alpha = 0.5) +
# geom_point(yearly_num_Attr_Deaths_exclude_states,
# mapping = aes(x = as.Date(as.yearmon(year)), y = death_lb, group = 1,
# color = "c"), alpha = 0.5) +
theme(axis.text.y=element_text(size=10, family = "Times"),
axis.title=element_text(size=10,face="bold", family = "Times"),
panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 10, family = "Times"),
panel.background = element_rect("white"),
legend.text=element_text(size=9, family = "Times"),
legend.position = c(.4,.85),
# legend.position = "bottom",
legend.box="vertical", legend.margin=margin()) +
guides(color=guide_legend(nrow=2,byrow=TRUE)) +
labs(x = "Year", y = "Yearly Drug Overdose Deaths Attributable to DIH Prosecutions Reported in Media", color = "",
linetype = "", shape = "") +
scale_color_manual(values=c('black', 'green', 'red'),
labels = c("Main Analysis: Unintentional Drug Overdose Deaths",
"Excluding States with At Least 75% Missing Monthly", "2 Year Effect")) +
scale_x_date(date_labels="%Y", breaks = seq(as.Date("2000-01-01"), as.Date("2018-01-01"), by = "2 years")) +
scale_linetype_manual(values = c("Estimate" = "solid", "95% Confidence Interval" = "dashed"),
breaks = c("Estimate", "95% Confidence Interval")) +
guides(linetype = guide_legend(nrow = 1)) +
scale_shape_manual(values = c(16, 4, 5, 2),
labels = c("Main Analysis: Unintentional Drug Overdose Deaths",
"Excluding States with At Least 75% Missing Monthly", "2 Year Effect"))

# dev.off()
Sensitivity Analysis 6: Event Study
Analysis
#create the dataset for the event study to check for pre-trend analysis
time_data_int <- main_analysis_data %>%
#group by the state
group_by(State) %>%
#find the time interval ID for the intervention time
summarise(intervention_time_id = ifelse(floor_date(Intervention_First_Date, "6 months") == Time_Period_Start, Time_Period_ID, NA)) %>%
#filter out the other time periods that aren't the intervention date
filter(!is.na(intervention_time_id))
#merge the time_data_int with the main dataset
merged_main_time_data_int <- merge(main_analysis_data, time_data_int, by = "State", all.x = TRUE)
#create the columns that associate with the periods before the intervention
#the max number of periods before the intervention is determined by the maximum time period of the intervention
neg_periods_df <- sapply(1:(max(merged_main_time_data_int$intervention_time_id, na.rm = TRUE) - 1),
#the indicator for x periods before intervention is equal to 1 if the time ID of intervention minus time ID is equal to x
function(x){ifelse(merged_main_time_data_int$intervention_time_id -
merged_main_time_data_int$Time_Period_ID == x, 1, 0)})
#create the column names
colnames(neg_periods_df) <- sapply(1:(max(merged_main_time_data_int$intervention_time_id, na.rm = TRUE) - 1),
function(x){paste("neg_", x, "_pd", sep = "")})
#add in the state and time ID columns
neg_periods_df <- cbind(neg_periods_df, "State" = merged_main_time_data_int$State,
"Time_Period_ID" = merged_main_time_data_int$Time_Period_ID)
#for Hawaii, impute a 0 because it is NA right now
neg_periods_df[neg_periods_df[,"State"] == "Hawaii", 1:34] <- 0
#create the columns that associate with the periods after the intervention
#the max number of periods after the intervention is determined by the maximum Time ID minus the minus time period of the intervention
#the period 0 is associated with intervention time
pos_periods_df <- sapply(0:(max(merged_main_time_data_int$Time_Period_ID) -
min(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)),
function(x){ifelse(merged_main_time_data_int$Time_Period_ID -
merged_main_time_data_int$intervention_time_id == x, 1, 0)})
#create the column names
colnames(pos_periods_df) <- sapply(0:(max(merged_main_time_data_int$Time_Period_ID) -
min(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)),
function(x){paste("pos_", x, "_pd", sep = "")})
#add in the state and time ID columns
pos_periods_df <- cbind(pos_periods_df, "State" = merged_main_time_data_int$State,
"Time_Period_ID" = merged_main_time_data_int$Time_Period_ID)
#for Hawaii, impute a 0 because it is NA right now
pos_periods_df[pos_periods_df[,"State"] == "Hawaii", 1:40] <- 0
#merge the columns of indicators for before and after the intervention with the main analysis data to create the dataset for event study
sensitivity_anlys_event_study_data <- merge(main_analysis_data,
neg_periods_df, by = c("State", "Time_Period_ID"))
sensitivity_anlys_event_study_data <- merge(sensitivity_anlys_event_study_data,
pos_periods_df, by = c("State", "Time_Period_ID"))
#change the indicator values to numeric type
sensitivity_anlys_event_study_data[, 28:101] <- apply(sensitivity_anlys_event_study_data[, 28:101], 2, as.numeric)
#create a formula for the gam model which includes the state effects, smoothed time effects, policy measures,
#the periods before the intervention (excluding 1 period and 34 periods before intervention)
#the intervention period, and the periods after the intervention
formula_event_study <- formula(paste("cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = 'cr', by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +",
paste(sapply(2:(max(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)-2),
function(x)paste("neg_", x, "_pd", sep = "")), collapse = "+"),
"+",
paste(sapply(0:(max(merged_main_time_data_int$Time_Period_ID) -
min(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)),
function(x)paste("pos_", x, "_pd", sep = "")), collapse = "+")))
#run the gam model
sensitivity_anlys_event_study_model<-gam(formula_event_study,
data = sensitivity_anlys_event_study_data, family = "binomial")
summary(sensitivity_anlys_event_study_model)
##
## Family: binomial
## Link function: logit
##
## Formula:
## cbind(round(imputed_deaths), round(num_alive)) ~ State + s(Time_Period_ID,
## bs = "cr", by = as.factor(Region)) + Naloxone_Pharmacy_Yes_Redefined +
## Naloxone_Pharmacy_No_Redefined + Medical_Marijuana_Redefined +
## Recreational_Marijuana_Redefined + GSL_Redefined + PDMP_Redefined +
## Medicaid_Expansion_Redefined + neg_2_pd + neg_3_pd + neg_4_pd +
## neg_5_pd + neg_6_pd + neg_7_pd + neg_8_pd + neg_9_pd + neg_10_pd +
## neg_11_pd + neg_12_pd + neg_13_pd + neg_14_pd + neg_15_pd +
## neg_16_pd + neg_17_pd + neg_18_pd + neg_19_pd + neg_20_pd +
## neg_21_pd + neg_22_pd + neg_23_pd + neg_24_pd + neg_25_pd +
## neg_26_pd + neg_27_pd + neg_28_pd + neg_29_pd + neg_30_pd +
## neg_31_pd + neg_32_pd + neg_33_pd + pos_0_pd + pos_1_pd +
## pos_2_pd + pos_3_pd + pos_4_pd + pos_5_pd + pos_6_pd + pos_7_pd +
## pos_8_pd + pos_9_pd + pos_10_pd + pos_11_pd + pos_12_pd +
## pos_13_pd + pos_14_pd + pos_15_pd + pos_16_pd + pos_17_pd +
## pos_18_pd + pos_19_pd + pos_20_pd + pos_21_pd + pos_22_pd +
## pos_23_pd + pos_24_pd + pos_25_pd + pos_26_pd + pos_27_pd +
## pos_28_pd + pos_29_pd + pos_30_pd + pos_31_pd + pos_32_pd +
## pos_33_pd + pos_34_pd + pos_35_pd + pos_36_pd + pos_37_pd +
## pos_38_pd + pos_39_pd
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -9.651504 0.017947 -537.770 < 2e-16 ***
## StateAlaska 0.075635 0.043387 1.743 0.081288 .
## StateArizona 0.202488 0.023219 8.721 < 2e-16 ***
## StateArkansas -0.491118 0.024405 -20.124 < 2e-16 ***
## StateCalifornia 0.061777 0.029846 2.070 0.038466 *
## StateColorado 0.011460 0.022023 0.520 0.602806
## StateConnecticut 0.189897 0.015616 12.161 < 2e-16 ***
## StateDelaware 0.193927 0.041752 4.645 3.40e-06 ***
## StateFlorida 0.474179 0.031311 15.144 < 2e-16 ***
## StateGeorgia 0.179491 0.035767 5.018 5.21e-07 ***
## StateHawaii -0.413907 0.033691 -12.285 < 2e-16 ***
## StateIdaho -0.326175 0.039039 -8.355 < 2e-16 ***
## StateIllinois 0.151352 0.026144 5.789 7.07e-09 ***
## StateIndiana 0.020731 0.016176 1.282 0.200007
## StateIowa -0.624627 0.025880 -24.135 < 2e-16 ***
## StateKansas -0.312050 0.019568 -15.947 < 2e-16 ***
## StateKentucky 0.542078 0.019951 27.171 < 2e-16 ***
## StateLouisiana 0.417753 0.021878 19.094 < 2e-16 ***
## StateMaine 0.138764 0.022131 6.270 3.61e-10 ***
## StateMaryland -0.902707 0.029912 -30.179 < 2e-16 ***
## StateMassachusetts 0.214646 0.013824 15.528 < 2e-16 ***
## StateMichigan 0.076360 0.017080 4.471 7.79e-06 ***
## StateMinnesota -0.595539 0.017496 -34.039 < 2e-16 ***
## StateMississippi -0.275884 0.032428 -8.508 < 2e-16 ***
## StateMissouri 0.260749 0.017980 14.502 < 2e-16 ***
## StateMontana -0.223485 0.033925 -6.588 4.47e-11 ***
## StateNebraska -1.040176 0.035184 -29.564 < 2e-16 ***
## StateNevada 0.540545 0.019544 27.658 < 2e-16 ***
## StateNew Hampshire 0.200188 0.021439 9.338 < 2e-16 ***
## StateNew Jersey 0.274770 0.026377 10.417 < 2e-16 ***
## StateNew Mexico 0.572381 0.018888 30.305 < 2e-16 ***
## StateNew York -0.219566 0.012808 -17.143 < 2e-16 ***
## StateNorth Carolina 0.272914 0.017776 15.353 < 2e-16 ***
## StateNorth Dakota -1.205254 0.049995 -24.107 < 2e-16 ***
## StateOhio 0.711937 0.035341 20.145 < 2e-16 ***
## StateOklahoma 0.307222 0.019388 15.846 < 2e-16 ***
## StateOregon -0.225207 0.019131 -11.772 < 2e-16 ***
## StatePennsylvania 0.659183 0.031397 20.995 < 2e-16 ***
## StateRhode Island 0.069725 0.033109 2.106 0.035210 *
## StateSouth Carolina 0.002489 0.036210 0.069 0.945201
## StateSouth Dakota -1.221829 0.056324 -21.693 < 2e-16 ***
## StateTennessee 0.438016 0.012976 33.755 < 2e-16 ***
## StateTexas 0.012083 0.029464 0.410 0.681732
## StateUtah 0.158116 0.020803 7.601 2.95e-14 ***
## StateVermont -0.201387 0.031905 -6.312 2.75e-10 ***
## StateVirginia 0.026224 0.023147 1.133 0.257250
## StateWashington 0.070510 0.015766 4.472 7.74e-06 ***
## StateWest Virginia 0.741449 0.025841 28.693 < 2e-16 ***
## StateWisconsin 0.079398 0.022058 3.599 0.000319 ***
## StateWyoming -0.012928 0.034200 -0.378 0.705433
## Naloxone_Pharmacy_Yes_Redefined -0.017526 0.007883 -2.223 0.026187 *
## Naloxone_Pharmacy_No_Redefined 0.017969 0.006674 2.692 0.007100 **
## Medical_Marijuana_Redefined 0.046097 0.006037 7.635 2.26e-14 ***
## Recreational_Marijuana_Redefined -0.035227 0.008823 -3.992 6.54e-05 ***
## GSL_Redefined 0.051810 0.005796 8.939 < 2e-16 ***
## PDMP_Redefined -0.039779 0.005902 -6.740 1.58e-11 ***
## Medicaid_Expansion_Redefined 0.099983 0.006155 16.245 < 2e-16 ***
## neg_2_pd 0.044589 0.014267 3.125 0.001776 **
## neg_3_pd 0.092340 0.015090 6.119 9.40e-10 ***
## neg_4_pd 0.053704 0.016703 3.215 0.001304 **
## neg_5_pd 0.007083 0.018065 0.392 0.694988
## neg_6_pd 0.034815 0.019593 1.777 0.075588 .
## neg_7_pd -0.033992 0.021334 -1.593 0.111087
## neg_8_pd -0.056195 0.023038 -2.439 0.014719 *
## neg_9_pd 0.015921 0.024470 0.651 0.515276
## neg_10_pd 0.015269 0.026170 0.583 0.559586
## neg_11_pd 0.022834 0.028063 0.814 0.415836
## neg_12_pd 0.088708 0.029972 2.960 0.003079 **
## neg_13_pd 0.092424 0.031777 2.908 0.003632 **
## neg_14_pd 0.020288 0.034039 0.596 0.551158
## neg_15_pd 0.031990 0.036001 0.889 0.374216
## neg_16_pd 0.054750 0.038465 1.423 0.154628
## neg_17_pd 0.076053 0.041430 1.836 0.066398 .
## neg_18_pd 0.041045 0.044281 0.927 0.353977
## neg_19_pd 0.053330 0.046480 1.147 0.251225
## neg_20_pd 0.050543 0.049164 1.028 0.303925
## neg_21_pd 0.064060 0.052637 1.217 0.223596
## neg_22_pd 0.067077 0.055191 1.215 0.224226
## neg_23_pd 0.097399 0.058146 1.675 0.093918 .
## neg_24_pd 0.079982 0.064646 1.237 0.216005
## neg_25_pd 0.096844 0.067147 1.442 0.149226
## neg_26_pd 0.093410 0.075005 1.245 0.212991
## neg_27_pd 0.021516 0.084573 0.254 0.799178
## neg_28_pd 0.016059 0.088228 0.182 0.855572
## neg_29_pd 0.160505 0.091018 1.763 0.077826 .
## neg_30_pd 0.235909 0.098398 2.397 0.016508 *
## neg_31_pd 0.291011 0.101860 2.857 0.004277 **
## neg_32_pd 0.331214 0.111707 2.965 0.003027 **
## neg_33_pd 0.354047 0.216070 1.639 0.101301
## pos_0_pd -0.003253 0.013954 -0.233 0.815653
## pos_1_pd 0.024242 0.014225 1.704 0.088343 .
## pos_2_pd 0.015177 0.014878 1.020 0.307669
## pos_3_pd -0.034404 0.015853 -2.170 0.029990 *
## pos_4_pd -0.045386 0.016927 -2.681 0.007336 **
## pos_5_pd -0.095568 0.018248 -5.237 1.63e-07 ***
## pos_6_pd -0.115182 0.019648 -5.862 4.56e-09 ***
## pos_7_pd -0.102463 0.021102 -4.856 1.20e-06 ***
## pos_8_pd -0.146838 0.022787 -6.444 1.16e-10 ***
## pos_9_pd -0.172121 0.024463 -7.036 1.98e-12 ***
## pos_10_pd -0.189224 0.026165 -7.232 4.76e-13 ***
## pos_11_pd -0.200977 0.027931 -7.195 6.22e-13 ***
## pos_12_pd -0.210351 0.029726 -7.076 1.48e-12 ***
## pos_13_pd -0.277996 0.031608 -8.795 < 2e-16 ***
## pos_14_pd -0.282422 0.033506 -8.429 < 2e-16 ***
## pos_15_pd -0.274113 0.035462 -7.730 1.08e-14 ***
## pos_16_pd -0.299319 0.037364 -8.011 1.14e-15 ***
## pos_17_pd -0.305114 0.039351 -7.754 8.92e-15 ***
## pos_18_pd -0.329689 0.041335 -7.976 1.51e-15 ***
## pos_19_pd -0.317185 0.043242 -7.335 2.21e-13 ***
## pos_20_pd -0.367022 0.045274 -8.107 5.20e-16 ***
## pos_21_pd -0.393710 0.047244 -8.334 < 2e-16 ***
## pos_22_pd -0.394717 0.049212 -8.021 1.05e-15 ***
## pos_23_pd -0.407304 0.051257 -7.946 1.92e-15 ***
## pos_24_pd -0.430030 0.053315 -8.066 7.27e-16 ***
## pos_25_pd -0.449026 0.055414 -8.103 5.36e-16 ***
## pos_26_pd -0.471027 0.057377 -8.209 2.23e-16 ***
## pos_27_pd -0.492293 0.059403 -8.287 < 2e-16 ***
## pos_28_pd -0.488783 0.061347 -7.968 1.62e-15 ***
## pos_29_pd -0.513671 0.063381 -8.104 5.30e-16 ***
## pos_30_pd -0.502791 0.065403 -7.688 1.50e-14 ***
## pos_31_pd -0.428952 0.067480 -6.357 2.06e-10 ***
## pos_32_pd -0.466270 0.069545 -6.705 2.02e-11 ***
## pos_33_pd -0.515994 0.071591 -7.208 5.70e-13 ***
## pos_34_pd -0.514650 0.073590 -6.993 2.68e-12 ***
## pos_35_pd -0.644671 0.075806 -8.504 < 2e-16 ***
## pos_36_pd -0.668141 0.077872 -8.580 < 2e-16 ***
## pos_37_pd -0.607594 0.080373 -7.560 4.04e-14 ***
## pos_38_pd -0.673039 0.083997 -8.013 1.12e-15 ***
## pos_39_pd -0.607081 0.086088 -7.052 1.77e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(Time_Period_ID):as.factor(Region)Midwest 8.896 8.996 1513 <2e-16 ***
## s(Time_Period_ID):as.factor(Region)Northeast 8.925 8.998 1953 <2e-16 ***
## s(Time_Period_ID):as.factor(Region)South 8.909 8.997 2043 <2e-16 ***
## s(Time_Period_ID):as.factor(Region)West 8.518 8.931 1100 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.918 Deviance explained = 91.1%
## UBRE = 8.1342 Scale est. = 1 n = 2000
stargazer(sensitivity_anlys_event_study_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.076*
|
|
|
(0.043)
|
|
|
|
|
StateArizona
|
0.202***
|
|
|
(0.023)
|
|
|
|
|
StateArkansas
|
-0.491***
|
|
|
(0.024)
|
|
|
|
|
StateCalifornia
|
0.062**
|
|
|
(0.030)
|
|
|
|
|
StateColorado
|
0.011
|
|
|
(0.022)
|
|
|
|
|
StateConnecticut
|
0.190***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.194***
|
|
|
(0.042)
|
|
|
|
|
StateFlorida
|
0.474***
|
|
|
(0.031)
|
|
|
|
|
StateGeorgia
|
0.179***
|
|
|
(0.036)
|
|
|
|
|
StateHawaii
|
-0.414***
|
|
|
(0.034)
|
|
|
|
|
StateIdaho
|
-0.326***
|
|
|
(0.039)
|
|
|
|
|
StateIllinois
|
0.151***
|
|
|
(0.026)
|
|
|
|
|
StateIndiana
|
0.021
|
|
|
(0.016)
|
|
|
|
|
StateIowa
|
-0.625***
|
|
|
(0.026)
|
|
|
|
|
StateKansas
|
-0.312***
|
|
|
(0.020)
|
|
|
|
|
StateKentucky
|
0.542***
|
|
|
(0.020)
|
|
|
|
|
StateLouisiana
|
0.418***
|
|
|
(0.022)
|
|
|
|
|
StateMaine
|
0.139***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-0.903***
|
|
|
(0.030)
|
|
|
|
|
StateMassachusetts
|
0.215***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
0.076***
|
|
|
(0.017)
|
|
|
|
|
StateMinnesota
|
-0.596***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.276***
|
|
|
(0.032)
|
|
|
|
|
StateMissouri
|
0.261***
|
|
|
(0.018)
|
|
|
|
|
StateMontana
|
-0.223***
|
|
|
(0.034)
|
|
|
|
|
StateNebraska
|
-1.040***
|
|
|
(0.035)
|
|
|
|
|
StateNevada
|
0.541***
|
|
|
(0.020)
|
|
|
|
|
StateNew Hampshire
|
0.200***
|
|
|
(0.021)
|
|
|
|
|
StateNew Jersey
|
0.275***
|
|
|
(0.026)
|
|
|
|
|
StateNew Mexico
|
0.572***
|
|
|
(0.019)
|
|
|
|
|
StateNew York
|
-0.220***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.273***
|
|
|
(0.018)
|
|
|
|
|
StateNorth Dakota
|
-1.205***
|
|
|
(0.050)
|
|
|
|
|
StateOhio
|
0.712***
|
|
|
(0.035)
|
|
|
|
|
StateOklahoma
|
0.307***
|
|
|
(0.019)
|
|
|
|
|
StateOregon
|
-0.225***
|
|
|
(0.019)
|
|
|
|
|
StatePennsylvania
|
0.659***
|
|
|
(0.031)
|
|
|
|
|
StateRhode Island
|
0.070**
|
|
|
(0.033)
|
|
|
|
|
StateSouth Carolina
|
0.002
|
|
|
(0.036)
|
|
|
|
|
StateSouth Dakota
|
-1.222***
|
|
|
(0.056)
|
|
|
|
|
StateTennessee
|
0.438***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
0.012
|
|
|
(0.029)
|
|
|
|
|
StateUtah
|
0.158***
|
|
|
(0.021)
|
|
|
|
|
StateVermont
|
-0.201***
|
|
|
(0.032)
|
|
|
|
|
StateVirginia
|
0.026
|
|
|
(0.023)
|
|
|
|
|
StateWashington
|
0.071***
|
|
|
(0.016)
|
|
|
|
|
StateWest Virginia
|
0.741***
|
|
|
(0.026)
|
|
|
|
|
StateWisconsin
|
0.079***
|
|
|
(0.022)
|
|
|
|
|
StateWyoming
|
-0.013
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.018**
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.018***
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.046***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.035***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.052***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.040***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.100***
|
|
|
(0.006)
|
|
|
|
|
neg_2_pd
|
0.045***
|
|
|
(0.014)
|
|
|
|
|
neg_3_pd
|
0.092***
|
|
|
(0.015)
|
|
|
|
|
neg_4_pd
|
0.054***
|
|
|
(0.017)
|
|
|
|
|
neg_5_pd
|
0.007
|
|
|
(0.018)
|
|
|
|
|
neg_6_pd
|
0.035*
|
|
|
(0.020)
|
|
|
|
|
neg_7_pd
|
-0.034
|
|
|
(0.021)
|
|
|
|
|
neg_8_pd
|
-0.056**
|
|
|
(0.023)
|
|
|
|
|
neg_9_pd
|
0.016
|
|
|
(0.024)
|
|
|
|
|
neg_10_pd
|
0.015
|
|
|
(0.026)
|
|
|
|
|
neg_11_pd
|
0.023
|
|
|
(0.028)
|
|
|
|
|
neg_12_pd
|
0.089***
|
|
|
(0.030)
|
|
|
|
|
neg_13_pd
|
0.092***
|
|
|
(0.032)
|
|
|
|
|
neg_14_pd
|
0.020
|
|
|
(0.034)
|
|
|
|
|
neg_15_pd
|
0.032
|
|
|
(0.036)
|
|
|
|
|
neg_16_pd
|
0.055
|
|
|
(0.038)
|
|
|
|
|
neg_17_pd
|
0.076*
|
|
|
(0.041)
|
|
|
|
|
neg_18_pd
|
0.041
|
|
|
(0.044)
|
|
|
|
|
neg_19_pd
|
0.053
|
|
|
(0.046)
|
|
|
|
|
neg_20_pd
|
0.051
|
|
|
(0.049)
|
|
|
|
|
neg_21_pd
|
0.064
|
|
|
(0.053)
|
|
|
|
|
neg_22_pd
|
0.067
|
|
|
(0.055)
|
|
|
|
|
neg_23_pd
|
0.097*
|
|
|
(0.058)
|
|
|
|
|
neg_24_pd
|
0.080
|
|
|
(0.065)
|
|
|
|
|
neg_25_pd
|
0.097
|
|
|
(0.067)
|
|
|
|
|
neg_26_pd
|
0.093
|
|
|
(0.075)
|
|
|
|
|
neg_27_pd
|
0.022
|
|
|
(0.085)
|
|
|
|
|
neg_28_pd
|
0.016
|
|
|
(0.088)
|
|
|
|
|
neg_29_pd
|
0.161*
|
|
|
(0.091)
|
|
|
|
|
neg_30_pd
|
0.236**
|
|
|
(0.098)
|
|
|
|
|
neg_31_pd
|
0.291***
|
|
|
(0.102)
|
|
|
|
|
neg_32_pd
|
0.331***
|
|
|
(0.112)
|
|
|
|
|
neg_33_pd
|
0.354
|
|
|
(0.216)
|
|
|
|
|
pos_0_pd
|
-0.003
|
|
|
(0.014)
|
|
|
|
|
pos_1_pd
|
0.024*
|
|
|
(0.014)
|
|
|
|
|
pos_2_pd
|
0.015
|
|
|
(0.015)
|
|
|
|
|
pos_3_pd
|
-0.034**
|
|
|
(0.016)
|
|
|
|
|
pos_4_pd
|
-0.045***
|
|
|
(0.017)
|
|
|
|
|
pos_5_pd
|
-0.096***
|
|
|
(0.018)
|
|
|
|
|
pos_6_pd
|
-0.115***
|
|
|
(0.020)
|
|
|
|
|
pos_7_pd
|
-0.102***
|
|
|
(0.021)
|
|
|
|
|
pos_8_pd
|
-0.147***
|
|
|
(0.023)
|
|
|
|
|
pos_9_pd
|
-0.172***
|
|
|
(0.024)
|
|
|
|
|
pos_10_pd
|
-0.189***
|
|
|
(0.026)
|
|
|
|
|
pos_11_pd
|
-0.201***
|
|
|
(0.028)
|
|
|
|
|
pos_12_pd
|
-0.210***
|
|
|
(0.030)
|
|
|
|
|
pos_13_pd
|
-0.278***
|
|
|
(0.032)
|
|
|
|
|
pos_14_pd
|
-0.282***
|
|
|
(0.034)
|
|
|
|
|
pos_15_pd
|
-0.274***
|
|
|
(0.035)
|
|
|
|
|
pos_16_pd
|
-0.299***
|
|
|
(0.037)
|
|
|
|
|
pos_17_pd
|
-0.305***
|
|
|
(0.039)
|
|
|
|
|
pos_18_pd
|
-0.330***
|
|
|
(0.041)
|
|
|
|
|
pos_19_pd
|
-0.317***
|
|
|
(0.043)
|
|
|
|
|
pos_20_pd
|
-0.367***
|
|
|
(0.045)
|
|
|
|
|
pos_21_pd
|
-0.394***
|
|
|
(0.047)
|
|
|
|
|
pos_22_pd
|
-0.395***
|
|
|
(0.049)
|
|
|
|
|
pos_23_pd
|
-0.407***
|
|
|
(0.051)
|
|
|
|
|
pos_24_pd
|
-0.430***
|
|
|
(0.053)
|
|
|
|
|
pos_25_pd
|
-0.449***
|
|
|
(0.055)
|
|
|
|
|
pos_26_pd
|
-0.471***
|
|
|
(0.057)
|
|
|
|
|
pos_27_pd
|
-0.492***
|
|
|
(0.059)
|
|
|
|
|
pos_28_pd
|
-0.489***
|
|
|
(0.061)
|
|
|
|
|
pos_29_pd
|
-0.514***
|
|
|
(0.063)
|
|
|
|
|
pos_30_pd
|
-0.503***
|
|
|
(0.065)
|
|
|
|
|
pos_31_pd
|
-0.429***
|
|
|
(0.067)
|
|
|
|
|
pos_32_pd
|
-0.466***
|
|
|
(0.070)
|
|
|
|
|
pos_33_pd
|
-0.516***
|
|
|
(0.072)
|
|
|
|
|
pos_34_pd
|
-0.515***
|
|
|
(0.074)
|
|
|
|
|
pos_35_pd
|
-0.645***
|
|
|
(0.076)
|
|
|
|
|
pos_36_pd
|
-0.668***
|
|
|
(0.078)
|
|
|
|
|
pos_37_pd
|
-0.608***
|
|
|
(0.080)
|
|
|
|
|
pos_38_pd
|
-0.673***
|
|
|
(0.084)
|
|
|
|
|
pos_39_pd
|
-0.607***
|
|
|
(0.086)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.652***
|
|
|
(0.018)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.918
|
|
Log Likelihood
|
-16,044.990
|
|
UBRE
|
8.134
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
full_df_w_basis_functions_sensitivity_anlys_event_study <- data.frame(predict(sensitivity_anlys_event_study_model, type = "lpmatrix"))
#estimate the 95% CI and SD
coefficient_values_sensitivity_anlys_event_study <- coef(sensitivity_anlys_event_study_model)
#type = "response" to get the estimated probabilities
pred_prob_sensitivity_anlys_event_study <- predict(sensitivity_anlys_event_study_model,
newdata = sensitivity_anlys_event_study_data, type = "response")
sensitivity_anlys_event_study_sd_and_ci <- compute_sd_and_CI(full_df_w_basis_functions_sensitivity_anlys_event_study,
sensitivity_anlys_event_study_data$population,
sensitivity_anlys_event_study_data$imputed_deaths,
pred_prob_sensitivity_anlys_event_study,
coefficient_values_sensitivity_anlys_event_study)
round(sensitivity_anlys_event_study_sd_and_ci, 3)
## lb_coef coef_values ub_coef
## (Intercept) -9.765 -9.652 -9.538
## StateAlaska -0.051 0.076 0.202
## StateArizona 0.124 0.202 0.281
## StateArkansas -0.576 -0.491 -0.406
## StateCalifornia -0.036 0.062 0.159
## StateColorado -0.078 0.011 0.101
## StateConnecticut 0.108 0.190 0.272
## StateDelaware 0.057 0.194 0.330
## StateFlorida 0.384 0.474 0.564
## StateGeorgia 0.084 0.179 0.275
## StateHawaii -0.544 -0.414 -0.283
## StateIdaho -0.422 -0.326 -0.230
## StateIllinois 0.056 0.151 0.247
## StateIndiana -0.049 0.021 0.090
## StateIowa -0.714 -0.625 -0.535
## StateKansas -0.407 -0.312 -0.217
## StateKentucky 0.469 0.542 0.615
## StateLouisiana 0.340 0.418 0.496
## StateMaine 0.040 0.139 0.238
## StateMaryland -1.124 -0.903 -0.681
## StateMassachusetts 0.115 0.215 0.314
## StateMichigan 0.005 0.076 0.148
## StateMinnesota -0.677 -0.596 -0.515
## StateMississippi -0.381 -0.276 -0.171
## StateMissouri 0.183 0.261 0.339
## StateMontana -0.320 -0.223 -0.127
## StateNebraska -1.145 -1.040 -0.936
## StateNevada 0.454 0.541 0.627
## StateNew Hampshire 0.110 0.200 0.290
## StateNew Jersey 0.175 0.275 0.375
## StateNew Mexico 0.484 0.572 0.660
## StateNew York -0.291 -0.220 -0.148
## StateNorth Carolina 0.200 0.273 0.345
## StateNorth Dakota -1.337 -1.205 -1.073
## StateOhio 0.607 0.712 0.817
## StateOklahoma 0.208 0.307 0.406
## StateOregon -0.309 -0.225 -0.141
## StatePennsylvania 0.572 0.659 0.746
## StateRhode Island -0.052 0.070 0.191
## StateSouth Carolina -0.088 0.002 0.093
## StateSouth Dakota -1.351 -1.222 -1.092
## StateTennessee 0.369 0.438 0.507
## StateTexas -0.078 0.012 0.103
## StateUtah 0.013 0.158 0.303
## StateVermont -0.298 -0.201 -0.105
## StateVirginia -0.062 0.026 0.114
## StateWashington -0.016 0.071 0.157
## StateWest Virginia 0.646 0.741 0.837
## StateWisconsin 0.007 0.079 0.151
## StateWyoming -0.122 -0.013 0.096
## Naloxone_Pharmacy_Yes_Redefined -0.065 -0.018 0.030
## Naloxone_Pharmacy_No_Redefined -0.017 0.018 0.053
## Medical_Marijuana_Redefined 0.004 0.046 0.088
## Recreational_Marijuana_Redefined -0.085 -0.035 0.015
## GSL_Redefined 0.011 0.052 0.093
## PDMP_Redefined -0.078 -0.040 -0.001
## Medicaid_Expansion_Redefined 0.067 0.100 0.133
## neg_2_pd -0.080 0.045 0.169
## neg_3_pd -0.028 0.092 0.212
## neg_4_pd -0.065 0.054 0.173
## neg_5_pd -0.114 0.007 0.128
## neg_6_pd -0.072 0.035 0.142
## neg_7_pd -0.158 -0.034 0.090
## neg_8_pd -0.194 -0.056 0.082
## neg_9_pd -0.118 0.016 0.150
## neg_10_pd -0.109 0.015 0.140
## neg_11_pd -0.121 0.023 0.166
## neg_12_pd -0.057 0.089 0.235
## neg_13_pd -0.072 0.092 0.257
## neg_14_pd -0.134 0.020 0.175
## neg_15_pd -0.152 0.032 0.216
## neg_16_pd -0.108 0.055 0.218
## neg_17_pd -0.088 0.076 0.240
## neg_18_pd -0.108 0.041 0.190
## neg_19_pd -0.101 0.053 0.207
## neg_20_pd -0.136 0.051 0.237
## neg_21_pd -0.100 0.064 0.228
## neg_22_pd -0.156 0.067 0.290
## neg_23_pd -0.080 0.097 0.275
## neg_24_pd -0.169 0.080 0.329
## neg_25_pd -0.250 0.097 0.443
## neg_26_pd -0.213 0.093 0.400
## neg_27_pd -0.290 0.022 0.333
## neg_28_pd -0.288 0.016 0.320
## neg_29_pd -0.065 0.161 0.386
## neg_30_pd 0.011 0.236 0.461
## neg_31_pd 0.038 0.291 0.544
## neg_32_pd 0.153 0.331 0.510
## neg_33_pd 0.150 0.354 0.558
## pos_0_pd -0.131 -0.003 0.125
## pos_1_pd -0.091 0.024 0.139
## pos_2_pd -0.094 0.015 0.124
## pos_3_pd -0.149 -0.034 0.080
## pos_4_pd -0.156 -0.045 0.066
## pos_5_pd -0.205 -0.096 0.014
## pos_6_pd -0.226 -0.115 -0.004
## pos_7_pd -0.218 -0.102 0.013
## pos_8_pd -0.260 -0.147 -0.034
## pos_9_pd -0.287 -0.172 -0.057
## pos_10_pd -0.309 -0.189 -0.069
## pos_11_pd -0.322 -0.201 -0.080
## pos_12_pd -0.330 -0.210 -0.090
## pos_13_pd -0.405 -0.278 -0.151
## pos_14_pd -0.415 -0.282 -0.150
## pos_15_pd -0.405 -0.274 -0.144
## pos_16_pd -0.435 -0.299 -0.164
## pos_17_pd -0.441 -0.305 -0.170
## pos_18_pd -0.474 -0.330 -0.186
## pos_19_pd -0.457 -0.317 -0.178
## pos_20_pd -0.512 -0.367 -0.222
## pos_21_pd -0.539 -0.394 -0.248
## pos_22_pd -0.547 -0.395 -0.242
## pos_23_pd -0.567 -0.407 -0.247
## pos_24_pd -0.593 -0.430 -0.267
## pos_25_pd -0.621 -0.449 -0.277
## pos_26_pd -0.643 -0.471 -0.299
## pos_27_pd -0.665 -0.492 -0.320
## pos_28_pd -0.664 -0.489 -0.314
## pos_29_pd -0.692 -0.514 -0.335
## pos_30_pd -0.682 -0.503 -0.324
## pos_31_pd -0.628 -0.429 -0.230
## pos_32_pd -0.663 -0.466 -0.270
## pos_33_pd -0.721 -0.516 -0.311
## pos_34_pd -0.744 -0.515 -0.285
## pos_35_pd -0.862 -0.645 -0.427
## pos_36_pd -0.885 -0.668 -0.452
## pos_37_pd -0.834 -0.608 -0.381
## pos_38_pd -0.894 -0.673 -0.452
## pos_39_pd -0.883 -0.607 -0.331
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.711 -0.536 -0.361
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.405 -0.292 -0.180
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.050 0.162 0.274
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.151 0.269 0.387
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.407 0.509 0.610
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.595 0.705 0.814
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.819 0.937 1.055
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.231 1.375 1.519
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.007 1.136 1.266
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.676 -0.502 -0.329
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.477 -0.355 -0.234
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.007 0.107 0.208
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.071 0.037 0.146
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.166 0.266 0.365
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.418 0.520 0.622
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.761 0.877 0.994
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.217 1.353 1.489
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.036 1.178 1.320
## s(Time_Period_ID):as.factor(Region)South.1 -0.383 -0.310 -0.236
## s(Time_Period_ID):as.factor(Region)South.2 -0.139 -0.087 -0.035
## s(Time_Period_ID):as.factor(Region)South.3 0.170 0.224 0.279
## s(Time_Period_ID):as.factor(Region)South.4 0.279 0.331 0.384
## s(Time_Period_ID):as.factor(Region)South.5 0.427 0.484 0.542
## s(Time_Period_ID):as.factor(Region)South.6 0.446 0.517 0.589
## s(Time_Period_ID):as.factor(Region)South.7 0.681 0.763 0.845
## s(Time_Period_ID):as.factor(Region)South.8 1.005 1.116 1.228
## s(Time_Period_ID):as.factor(Region)South.9 0.869 0.990 1.112
## s(Time_Period_ID):as.factor(Region)West.1 -0.429 -0.281 -0.133
## s(Time_Period_ID):as.factor(Region)West.2 -0.145 -0.032 0.081
## s(Time_Period_ID):as.factor(Region)West.3 0.041 0.148 0.256
## s(Time_Period_ID):as.factor(Region)West.4 0.203 0.303 0.403
## s(Time_Period_ID):as.factor(Region)West.5 0.235 0.334 0.433
## s(Time_Period_ID):as.factor(Region)West.6 0.310 0.410 0.509
## s(Time_Period_ID):as.factor(Region)West.7 0.441 0.542 0.643
## s(Time_Period_ID):as.factor(Region)West.8 0.589 0.709 0.829
## s(Time_Period_ID):as.factor(Region)West.9 0.774 0.886 0.998
## exp_lb exp_coef exp_ub sd_coef
## (Intercept) 0.000 0.000 0.000 0.058
## StateAlaska 0.951 1.079 1.224 0.064
## StateArizona 1.132 1.224 1.325 0.040
## StateArkansas 0.562 0.612 0.666 0.044
## StateCalifornia 0.965 1.064 1.173 0.050
## StateColorado 0.925 1.012 1.106 0.046
## StateConnecticut 1.114 1.209 1.312 0.042
## StateDelaware 1.059 1.214 1.392 0.070
## StateFlorida 1.469 1.607 1.757 0.046
## StateGeorgia 1.088 1.197 1.316 0.049
## StateHawaii 0.580 0.661 0.753 0.067
## StateIdaho 0.656 0.722 0.794 0.049
## StateIllinois 1.058 1.163 1.280 0.049
## StateIndiana 0.952 1.021 1.095 0.036
## StateIowa 0.490 0.535 0.586 0.046
## StateKansas 0.666 0.732 0.805 0.048
## StateKentucky 1.599 1.720 1.849 0.037
## StateLouisiana 1.405 1.519 1.641 0.040
## StateMaine 1.040 1.149 1.269 0.051
## StateMaryland 0.325 0.405 0.506 0.113
## StateMassachusetts 1.122 1.239 1.369 0.051
## StateMichigan 1.005 1.079 1.160 0.037
## StateMinnesota 0.508 0.551 0.598 0.041
## StateMississippi 0.684 0.759 0.843 0.053
## StateMissouri 1.200 1.298 1.403 0.040
## StateMontana 0.726 0.800 0.881 0.049
## StateNebraska 0.318 0.353 0.392 0.053
## StateNevada 1.575 1.717 1.872 0.044
## StateNew Hampshire 1.117 1.222 1.336 0.046
## StateNew Jersey 1.191 1.316 1.454 0.051
## StateNew Mexico 1.623 1.772 1.935 0.045
## StateNew York 0.748 0.803 0.862 0.036
## StateNorth Carolina 1.222 1.314 1.413 0.037
## StateNorth Dakota 0.263 0.300 0.342 0.067
## StateOhio 1.834 2.038 2.264 0.054
## StateOklahoma 1.232 1.360 1.501 0.050
## StateOregon 0.734 0.798 0.868 0.043
## StatePennsylvania 1.772 1.933 2.109 0.044
## StateRhode Island 0.950 1.072 1.210 0.062
## StateSouth Carolina 0.916 1.002 1.097 0.046
## StateSouth Dakota 0.259 0.295 0.335 0.066
## StateTennessee 1.446 1.550 1.661 0.035
## StateTexas 0.925 1.012 1.108 0.046
## StateUtah 1.013 1.171 1.354 0.074
## StateVermont 0.743 0.818 0.900 0.049
## StateVirginia 0.940 1.027 1.121 0.045
## StateWashington 0.984 1.073 1.170 0.044
## StateWest Virginia 1.908 2.099 2.309 0.049
## StateWisconsin 1.007 1.083 1.163 0.037
## StateWyoming 0.885 0.987 1.101 0.055
## Naloxone_Pharmacy_Yes_Redefined 0.937 0.983 1.031 0.024
## Naloxone_Pharmacy_No_Redefined 0.983 1.018 1.054 0.018
## Medical_Marijuana_Redefined 1.004 1.047 1.093 0.022
## Recreational_Marijuana_Redefined 0.918 0.965 1.015 0.026
## GSL_Redefined 1.011 1.053 1.097 0.021
## PDMP_Redefined 0.925 0.961 0.999 0.020
## Medicaid_Expansion_Redefined 1.070 1.105 1.142 0.017
## neg_2_pd 0.923 1.046 1.184 0.064
## neg_3_pd 0.973 1.097 1.237 0.061
## neg_4_pd 0.937 1.055 1.188 0.061
## neg_5_pd 0.892 1.007 1.137 0.062
## neg_6_pd 0.930 1.035 1.152 0.055
## neg_7_pd 0.854 0.967 1.094 0.063
## neg_8_pd 0.823 0.945 1.085 0.071
## neg_9_pd 0.888 1.016 1.162 0.069
## neg_10_pd 0.897 1.015 1.150 0.063
## neg_11_pd 0.886 1.023 1.181 0.073
## neg_12_pd 0.944 1.093 1.265 0.074
## neg_13_pd 0.930 1.097 1.293 0.084
## neg_14_pd 0.874 1.020 1.191 0.079
## neg_15_pd 0.859 1.033 1.241 0.094
## neg_16_pd 0.897 1.056 1.243 0.083
## neg_17_pd 0.916 1.079 1.271 0.084
## neg_18_pd 0.898 1.042 1.209 0.076
## neg_19_pd 0.904 1.055 1.230 0.079
## neg_20_pd 0.873 1.052 1.268 0.095
## neg_21_pd 0.905 1.066 1.256 0.084
## neg_22_pd 0.855 1.069 1.337 0.114
## neg_23_pd 0.923 1.102 1.317 0.091
## neg_24_pd 0.845 1.083 1.389 0.127
## neg_25_pd 0.779 1.102 1.558 0.177
## neg_26_pd 0.808 1.098 1.492 0.156
## neg_27_pd 0.749 1.022 1.395 0.159
## neg_28_pd 0.750 1.016 1.377 0.155
## neg_29_pd 0.937 1.174 1.471 0.115
## neg_30_pd 1.011 1.266 1.585 0.115
## neg_31_pd 1.039 1.338 1.723 0.129
## neg_32_pd 1.165 1.393 1.665 0.091
## neg_33_pd 1.162 1.425 1.747 0.104
## pos_0_pd 0.877 0.997 1.133 0.065
## pos_1_pd 0.913 1.025 1.150 0.059
## pos_2_pd 0.910 1.015 1.132 0.056
## pos_3_pd 0.862 0.966 1.083 0.058
## pos_4_pd 0.855 0.956 1.068 0.057
## pos_5_pd 0.815 0.909 1.014 0.056
## pos_6_pd 0.798 0.891 0.996 0.057
## pos_7_pd 0.804 0.903 1.013 0.059
## pos_8_pd 0.771 0.863 0.966 0.057
## pos_9_pd 0.750 0.842 0.945 0.059
## pos_10_pd 0.734 0.828 0.933 0.061
## pos_11_pd 0.725 0.818 0.923 0.062
## pos_12_pd 0.719 0.810 0.914 0.061
## pos_13_pd 0.667 0.757 0.860 0.065
## pos_14_pd 0.660 0.754 0.861 0.068
## pos_15_pd 0.667 0.760 0.866 0.067
## pos_16_pd 0.647 0.741 0.849 0.069
## pos_17_pd 0.644 0.737 0.844 0.069
## pos_18_pd 0.623 0.719 0.831 0.073
## pos_19_pd 0.633 0.728 0.837 0.071
## pos_20_pd 0.599 0.693 0.801 0.074
## pos_21_pd 0.583 0.675 0.780 0.074
## pos_22_pd 0.579 0.674 0.785 0.078
## pos_23_pd 0.567 0.665 0.781 0.082
## pos_24_pd 0.553 0.650 0.765 0.083
## pos_25_pd 0.537 0.638 0.758 0.088
## pos_26_pd 0.526 0.624 0.742 0.088
## pos_27_pd 0.514 0.611 0.726 0.088
## pos_28_pd 0.515 0.613 0.731 0.089
## pos_29_pd 0.501 0.598 0.715 0.091
## pos_30_pd 0.506 0.605 0.723 0.091
## pos_31_pd 0.534 0.651 0.795 0.102
## pos_32_pd 0.515 0.627 0.764 0.100
## pos_33_pd 0.486 0.597 0.732 0.104
## pos_34_pd 0.475 0.598 0.752 0.117
## pos_35_pd 0.422 0.525 0.652 0.111
## pos_36_pd 0.413 0.513 0.637 0.110
## pos_37_pd 0.434 0.545 0.683 0.115
## pos_38_pd 0.409 0.510 0.636 0.113
## pos_39_pd 0.413 0.545 0.718 0.141
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.491 0.585 0.697 0.089
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.667 0.746 0.835 0.057
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.051 1.176 1.315 0.057
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.163 1.309 1.473 0.060
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.503 1.663 1.841 0.052
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.814 2.023 2.257 0.056
## s(Time_Period_ID):as.factor(Region)Midwest.7 2.269 2.552 2.872 0.060
## s(Time_Period_ID):as.factor(Region)Midwest.8 3.425 3.956 4.570 0.074
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.736 3.116 3.547 0.066
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.509 0.605 0.720 0.088
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.621 0.701 0.791 0.062
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.007 1.113 1.231 0.051
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.931 1.038 1.157 0.055
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.181 1.304 1.441 0.051
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.519 1.682 1.862 0.052
## s(Time_Period_ID):as.factor(Region)Northeast.7 2.141 2.405 2.701 0.059
## s(Time_Period_ID):as.factor(Region)Northeast.8 3.376 3.868 4.431 0.069
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.818 3.247 3.742 0.072
## s(Time_Period_ID):as.factor(Region)South.1 0.681 0.734 0.790 0.038
## s(Time_Period_ID):as.factor(Region)South.2 0.871 0.917 0.966 0.027
## s(Time_Period_ID):as.factor(Region)South.3 1.185 1.251 1.321 0.028
## s(Time_Period_ID):as.factor(Region)South.4 1.322 1.393 1.468 0.027
## s(Time_Period_ID):as.factor(Region)South.5 1.533 1.623 1.719 0.029
## s(Time_Period_ID):as.factor(Region)South.6 1.562 1.678 1.801 0.036
## s(Time_Period_ID):as.factor(Region)South.7 1.976 2.145 2.328 0.042
## s(Time_Period_ID):as.factor(Region)South.8 2.731 3.054 3.414 0.057
## s(Time_Period_ID):as.factor(Region)South.9 2.385 2.692 3.039 0.062
## s(Time_Period_ID):as.factor(Region)West.1 0.651 0.755 0.875 0.075
## s(Time_Period_ID):as.factor(Region)West.2 0.865 0.969 1.085 0.058
## s(Time_Period_ID):as.factor(Region)West.3 1.042 1.160 1.292 0.055
## s(Time_Period_ID):as.factor(Region)West.4 1.225 1.354 1.496 0.051
## s(Time_Period_ID):as.factor(Region)West.5 1.265 1.396 1.542 0.050
## s(Time_Period_ID):as.factor(Region)West.6 1.363 1.506 1.664 0.051
## s(Time_Period_ID):as.factor(Region)West.7 1.554 1.720 1.903 0.052
## s(Time_Period_ID):as.factor(Region)West.8 1.802 2.032 2.292 0.061
## s(Time_Period_ID):as.factor(Region)West.9 2.167 2.425 2.713 0.057
# write.csv(round(sensitivity_anlys_event_study_sd_and_ci, 3), "./Data/event_study_coef_and_ci.csv")
Plot Results
#plot the coefficients for the periods before and after the intervention with 95% CI
plot_event_study <- sensitivity_anlys_event_study_sd_and_ci %>%
mutate(term = rownames(sensitivity_anlys_event_study_sd_and_ci)) %>%
dplyr::select(term, coef_values, lb_coef, ub_coef) %>%
filter(term %in% c(sapply(2:(max(merged_main_time_data_int$intervention_time_id, na.rm = TRUE) - 2),
function(x){paste("neg_", x, "_pd", sep = "")}),
sapply(0:(max(merged_main_time_data_int$Time_Period_ID) -
min(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)),
function(x){paste("pos_", x, "_pd", sep = "")})))
colnames(plot_event_study) <- c("term", "estimate", "conf.low", "conf.high")
dwplot(plot_event_study, colour = "black",
vars_order = c(sapply((max(merged_main_time_data_int$Time_Period_ID) -
min(merged_main_time_data_int$intervention_time_id, na.rm = TRUE)):0,
function(x){paste("pos_", x, "_pd", sep = "")}),
sapply(2:(max(merged_main_time_data_int$intervention_time_id, na.rm = TRUE) - 2),
function(x){paste("neg_", x, "_pd", sep = "")}))) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
axis.text.x = element_text(angle = 45)) +
geom_vline(aes(xintercept = 0), linetype = "dashed") +
labs(y = "States Excluded", x = "Coefficients and 95% Confidence Intervals",
title = "Coefficient of Pre-Intervention and Post-Intervention Periods") +
scale_color_grey() +
coord_flip() +
geom_hline(yintercept = 33, col = "red", linetype = "dashed")

Sensitivity Analysis 7: Effect of DIH Prosecutions on Unintentional Overdose Deaths, Including Two Intervention Variables
Analysis
########### Sensitivity Analysis 7: Two Year Intervention Effect ######################
#create a plot for each state to see how many prosecution media alerts there are per 6 month period
#read in the prosecution media alert data
prosecution_data <- read.csv("./Data/dih_prosecutions_9_6_21.csv")
#data cleaning
prosecution_data<-prosecution_data %>%
mutate(Date = as.Date(Date.charged, "%m/%d/%Y")) %>%
mutate(State = ifelse(State.Filed == "pennsylvania", "Pennsylvania", State.Filed),
State = ifelse(State.Filed == "Virginia ", "Virginia", State)) %>%
filter(!is.na(Date), State.Filed != "No Info", State.Filed != "No info", State.Filed != "No Info ",
State != "")
#clean up the data by looking at the link to the article
prosecution_data$Date[prosecution_data$Date == "2026-08-01"] <- as.Date("2016-02-15", "%Y-%m-%d")
#change the states into Character instead of factor
prosecution_data$State<-as.character(prosecution_data$State)
#see how many prosecution data points there are for each state
table(prosecution_data$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 76
Colorado Connecticut Delaware Florida Georgia
32 47 3 138 29
Idaho Illinois Indiana Iowa Kansas
9 342 55 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 63 34
Michigan Minnesota Mississippi Missouri Montana
116 140 1 45 11
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 137 4
New York North Carolina North Dakota Ohio Oklahoma
110 124 53 404 41
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 726 2 12 13
Tennessee Texas Utah Vermont Virginia
94 44 21 13 63
Washington West Virginia Wisconsin Wyoming
78 33 381 19
#there are some repeated cases depending on victim
prosecution_data_unique <- prosecution_data %>%
group_by(State) %>%
distinct(Accused.Name, Date, .keep_all = T)
table(prosecution_data_unique$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 72
Colorado Connecticut Delaware Florida Georgia
30 46 3 134 26
Idaho Illinois Indiana Iowa Kansas
9 336 53 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 62 34
Michigan Minnesota Mississippi Missouri Montana
114 140 1 44 10
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 131 4
New York North Carolina North Dakota Ohio Oklahoma
105 121 40 395 34
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 718 2 12 13
Tennessee Texas Utah Vermont Virginia
94 43 21 13 63
Washington West Virginia Wisconsin Wyoming
75 33 373 19
#change date charged into Date object
prosecution_data_unique$Date<-mdy(prosecution_data_unique$Date.charged)
#group the data into six month periods
prosecution_data<-prosecution_data_unique %>%
mutate(six_month_pd = lubridate::floor_date(Date , "6 months" ))
#count the number of prosecution media alerts in each six month period
#we also get the first and last date of prosecution in time period
prosecution_data_by_six_month_pd <- prosecution_data %>%
filter(year(six_month_pd)>1999 & year(six_month_pd)<2020) %>%
group_by(State, six_month_pd) %>%
summarise(first_date_in_pd = min(Date), last_date_in_pd = max(Date))
#create the data set used for this sensitivity analysis
#first, we merge the grouped prosecution data set with the main data set by state and time period
sensitivity_anlys_two_int_var<-merge(main_analysis_data,
prosecution_data_by_six_month_pd,
by.x = c("State", "Time_Period_Start"),
by.y = c("State", "six_month_pd"), all = TRUE)
#create a intervention 2 year effect variable by initializing it to be all 0
sensitivity_anlys_two_int_var<-sensitivity_anlys_two_int_var %>%
group_by(State) %>%
mutate(int_2_yr_effect = 0)
#change the date into a date object
sensitivity_anlys_two_int_var$Time_Period_Start<-as.Date(sensitivity_anlys_two_int_var$Time_Period_Start)
sensitivity_anlys_two_int_var$Time_Period_End<-as.Date(sensitivity_anlys_two_int_var$Time_Period_End)
#we need to impute the newly defined intervention variable depending on the case
#by examining each row of the data set
for(state in unique(sensitivity_anlys_two_int_var$State)){
#first, subset the data set into state_data which only contains the data for the state
state_index<-which(sensitivity_anlys_two_int_var$State == state)
state_data<-sensitivity_anlys_two_int_var[state_index,]
#note that the first four rows of the 2 year effect intervention variable are the same as the
#first four rows of the original intervention variable
state_data$int_2_yr_effect[1:4]<-state_data$Intervention_Redefined[1:4]
for(i in 5:nrow(state_data)){
#next, we deal with the rows where there was at least one prosecution in the last 3 six month periods
#These rows will be imputed with a 1
if((!is.na(state_data$first_date_in_pd[i - 1]) |
!is.na(state_data$first_date_in_pd[i - 2]) |
!is.na(state_data$first_date_in_pd[i - 3]))){
state_data$int_2_yr_effect[i]<-1
}else{
#next, we account for the rows with the fractions:
# 1) an intervention occurs in row i without an intervention 2 years ago
# 2) row i contains the lasting effects of an intervention that occurred 2 years ago
# 3) row i contains effects from both a new intervention starting in row i and lasting
# effects from 2 years ago
#To compute the fraction, we add the number of days that are affected by an intervention
#(from both the current prosecution and previous prosecution) and then divide by the total
#number of days in the period:
total_len_of_pd<-as.numeric(state_data$Time_Period_End[i] - state_data$Time_Period_Start[i])
#If there is no prosecution two years ago, i.e. in period i-4, then the last_date is the first
#date in period i. We subtract the last_date by the first date in the period, so we will get
#a 0 for the number of days that are affected by a prosecution from period i-4. Otherwise,
#the last_date is the last date of prosecution from period i-4, plus 2 years.
len_of_past_effect <- ifelse(!is.na(state_data$first_date_in_pd[i - 4]),
(state_data$last_date_in_pd[i - 4] + years(2)) - state_data$Time_Period_Start[i],
0)
#If there is no prosecution in the period i, then the start_date is the last date in the period i.
#We subtract start_date from the last date in period i, so we will get a 0 for the number
#of days that are affected by a prosecution in period i. Otherwise, the start_date is the
#first date of a prosecution in period i.
len_of_current_effect <- ifelse(!is.na(state_data$first_date_in_pd[i]),
as.numeric(state_data$Time_Period_End[i] - state_data$first_date_in_pd[i]),
0)
state_data$int_2_yr_effect[i]<-(len_of_past_effect + len_of_current_effect)/total_len_of_pd
}
}
#for the case where the int_2_yr_effect is greater than 1 (could result when we add the effects of
#previous intervention and the current intervention), we just impute a 1 instead
state_data$int_2_yr_effect[state_data$int_2_yr_effect>1]<-1
#lastly, we store the int_2_yr_effect variable into the sensitivity analysis data set
sensitivity_anlys_two_int_var$int_2_yr_effect[state_index]<-state_data$int_2_yr_effect
}
#view the data set just to make sure the imputation looks right
# View(sensitivity_anlys_two_int_var %>% select(State, Time_Period_Start, Time_Period_End,
# Intervention_Redefined, first_date_in_pd,
# last_date_in_pd,
# int_2_yr_effect))
sensitivity_anlys_two_int_var <- sensitivity_anlys_two_int_var %>%
group_by(Time_Period_Start) %>%
mutate(num_states_w_intervention_2_yr_effect = sum(int_2_yr_effect))
#run the analysis on the sensitivity analysis data
sensitivity_anlys_two_int_var_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
Intervention_Redefined +
num_states_w_intervention +
int_2_yr_effect,
# num_states_w_intervention_2_yr_effect,
data = sensitivity_anlys_two_int_var, family = "binomial")
stargazer(sensitivity_anlys_two_int_var_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.276***
|
|
|
(0.028)
|
|
|
|
|
StateArizona
|
0.319***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.373***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.161***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.094***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.183***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.431***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.246***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.065***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.223***
|
|
|
(0.026)
|
|
|
|
|
StateIdaho
|
-0.133***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.022*
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.085***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.742***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.317***
|
|
|
(0.020)
|
|
|
|
|
StateKentucky
|
0.640***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.291***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.144***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.070***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.208***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.027*
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.625***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.087***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.193***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.358***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.866***
|
|
|
(0.029)
|
|
|
|
|
StateNevada
|
0.441***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.254***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.106***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.640***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.243***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.175***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.055***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.448***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.385***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.197***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.429***
|
|
|
(0.012)
|
|
|
|
|
StateRhode Island
|
0.247***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.225***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-0.956***
|
|
|
(0.043)
|
|
|
|
|
StateTennessee
|
0.442***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.203***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.076***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.163***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.116***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.070***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.875***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.042***
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.026
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.030***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.004
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.066***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.039***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.035***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.018***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.101***
|
|
|
(0.006)
|
|
|
|
|
Intervention_Redefined
|
0.038***
|
|
|
(0.006)
|
|
|
|
|
num_states_w_intervention
|
0.003*
|
|
|
(0.002)
|
|
|
|
|
int_2_yr_effect
|
0.038***
|
|
|
(0.006)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.900***
|
|
|
(0.054)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.911
|
|
Log Likelihood
|
-16,730.440
|
|
UBRE
|
8.820
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#compute the full dataset including basis functions
sensitivity_anlys_two_int_var_w_basis <- data.frame(predict(sensitivity_anlys_two_int_var_model, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_two_int_var_coefficient_values <- coef(sensitivity_anlys_two_int_var_model)
#type = "response" to get the estimated probabilities
sensitivity_anlys_two_int_var_pred_prob <- predict(sensitivity_anlys_two_int_var_model,
newdata = sensitivity_anlys_two_int_var, type = "response")
two_int_results <- compute_sd_and_CI(sensitivity_anlys_two_int_var_w_basis,
sensitivity_anlys_two_int_var$population,
sensitivity_anlys_two_int_var$imputed_deaths,
sensitivity_anlys_two_int_var_pred_prob,
sensitivity_anlys_two_int_var_coefficient_values,
print_full_cov = TRUE)
sensitivity_anlys_two_int_var_sd_and_ci <- two_int_results[[1]]
round(sensitivity_anlys_two_int_var_sd_and_ci, 3)
## lb_coef coef_values ub_coef
## (Intercept) -10.224 -9.900 -9.576
## StateAlaska 0.175 0.276 0.378
## StateArizona 0.249 0.319 0.389
## StateArkansas -0.463 -0.373 -0.283
## StateCalifornia -0.242 -0.161 -0.080
## StateColorado 0.012 0.094 0.176
## StateConnecticut 0.101 0.183 0.265
## StateDelaware 0.303 0.431 0.560
## StateFlorida 0.171 0.246 0.321
## StateGeorgia -0.131 -0.065 0.000
## StateHawaii -0.327 -0.223 -0.120
## StateIdaho -0.220 -0.133 -0.046
## StateIllinois -0.108 -0.022 0.064
## StateIndiana 0.015 0.085 0.155
## StateIowa -0.827 -0.742 -0.657
## StateKansas -0.413 -0.317 -0.221
## StateKentucky 0.569 0.640 0.711
## StateLouisiana 0.220 0.291 0.363
## StateMaine 0.048 0.144 0.240
## StateMaryland -1.284 -1.070 -0.856
## StateMassachusetts 0.105 0.208 0.311
## StateMichigan -0.098 -0.027 0.045
## StateMinnesota -0.707 -0.625 -0.543
## StateMississippi -0.166 -0.087 -0.009
## StateMissouri 0.118 0.193 0.269
## StateMontana -0.447 -0.358 -0.269
## StateNebraska -0.963 -0.866 -0.770
## StateNevada 0.356 0.441 0.525
## StateNew Hampshire 0.167 0.254 0.341
## StateNew Jersey 0.009 0.106 0.203
## StateNew Mexico 0.553 0.640 0.726
## StateNew York -0.316 -0.243 -0.169
## StateNorth Carolina 0.109 0.175 0.240
## StateNorth Dakota -1.173 -1.055 -0.937
## StateOhio 0.366 0.448 0.530
## StateOklahoma 0.283 0.385 0.486
## StateOregon -0.282 -0.197 -0.112
## StatePennsylvania 0.359 0.429 0.498
## StateRhode Island 0.128 0.247 0.365
## StateSouth Carolina 0.159 0.225 0.290
## StateSouth Dakota -1.056 -0.956 -0.855
## StateTennessee 0.376 0.442 0.509
## StateTexas -0.277 -0.203 -0.129
## StateUtah -0.058 0.076 0.210
## StateVermont -0.257 -0.163 -0.069
## StateVirginia -0.196 -0.116 -0.037
## StateWashington -0.019 0.070 0.159
## StateWest Virginia 0.780 0.875 0.970
## StateWisconsin -0.106 -0.042 0.022
## StateWyoming -0.087 0.026 0.139
## Naloxone_Pharmacy_Yes_Redefined -0.082 -0.030 0.022
## Naloxone_Pharmacy_No_Redefined -0.034 0.004 0.043
## Medical_Marijuana_Redefined 0.021 0.066 0.111
## Recreational_Marijuana_Redefined -0.087 -0.039 0.008
## GSL_Redefined -0.008 0.035 0.079
## PDMP_Redefined -0.058 -0.018 0.022
## Medicaid_Expansion_Redefined 0.067 0.101 0.135
## Intervention_Redefined -0.002 0.038 0.078
## num_states_w_intervention -0.008 0.003 0.014
## int_2_yr_effect 0.002 0.038 0.073
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.560 -0.330 -0.100
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.278 -0.143 -0.008
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.078 0.194 0.310
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.069 0.204 0.338
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.157 0.333 0.508
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.185 0.424 0.662
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.329 0.607 0.884
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.610 0.937 1.264
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.420 0.718 1.017
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.548 -0.309 -0.069
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.404 -0.252 -0.100
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.052 0.171 0.290
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.142 -0.014 0.114
## s(Time_Period_ID):as.factor(Region)Northeast.5 -0.066 0.110 0.286
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.020 0.261 0.501
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.258 0.536 0.814
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.594 0.937 1.280
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.429 0.726 1.023
## s(Time_Period_ID):as.factor(Region)South.1 -0.297 -0.126 0.044
## s(Time_Period_ID):as.factor(Region)South.2 -0.074 0.030 0.135
## s(Time_Period_ID):as.factor(Region)South.3 0.188 0.251 0.315
## s(Time_Period_ID):as.factor(Region)South.4 0.175 0.259 0.344
## s(Time_Period_ID):as.factor(Region)South.5 0.158 0.320 0.483
## s(Time_Period_ID):as.factor(Region)South.6 0.030 0.257 0.484
## s(Time_Period_ID):as.factor(Region)South.7 0.178 0.442 0.706
## s(Time_Period_ID):as.factor(Region)South.8 0.384 0.713 1.041
## s(Time_Period_ID):as.factor(Region)South.9 0.261 0.547 0.834
## s(Time_Period_ID):as.factor(Region)West.1 -0.355 -0.121 0.114
## s(Time_Period_ID):as.factor(Region)West.2 -0.059 0.078 0.215
## s(Time_Period_ID):as.factor(Region)West.3 0.059 0.177 0.295
## s(Time_Period_ID):as.factor(Region)West.4 0.113 0.235 0.356
## s(Time_Period_ID):as.factor(Region)West.5 0.005 0.186 0.367
## s(Time_Period_ID):as.factor(Region)West.6 -0.083 0.162 0.406
## s(Time_Period_ID):as.factor(Region)West.7 -0.063 0.214 0.492
## s(Time_Period_ID):as.factor(Region)West.8 -0.024 0.319 0.662
## s(Time_Period_ID):as.factor(Region)West.9 0.142 0.432 0.721
## exp_lb exp_coef exp_ub sd_coef
## (Intercept) 0.000 0.000 0.000 0.165
## StateAlaska 1.191 1.318 1.459 0.052
## StateArizona 1.283 1.376 1.476 0.036
## StateArkansas 0.629 0.688 0.753 0.046
## StateCalifornia 0.785 0.851 0.923 0.041
## StateColorado 1.012 1.098 1.192 0.042
## StateConnecticut 1.106 1.201 1.303 0.042
## StateDelaware 1.354 1.539 1.750 0.066
## StateFlorida 1.186 1.279 1.379 0.038
## StateGeorgia 0.877 0.937 1.000 0.033
## StateHawaii 0.721 0.800 0.887 0.053
## StateIdaho 0.802 0.875 0.955 0.045
## StateIllinois 0.897 0.978 1.066 0.044
## StateIndiana 1.015 1.089 1.167 0.036
## StateIowa 0.438 0.476 0.518 0.043
## StateKansas 0.662 0.728 0.802 0.049
## StateKentucky 1.766 1.896 2.036 0.036
## StateLouisiana 1.246 1.338 1.437 0.036
## StateMaine 1.049 1.155 1.271 0.049
## StateMaryland 0.277 0.343 0.425 0.109
## StateMassachusetts 1.111 1.231 1.364 0.052
## StateMichigan 0.906 0.974 1.046 0.037
## StateMinnesota 0.493 0.535 0.581 0.042
## StateMississippi 0.847 0.916 0.991 0.040
## StateMissouri 1.125 1.213 1.308 0.038
## StateMontana 0.639 0.699 0.764 0.045
## StateNebraska 0.382 0.420 0.463 0.049
## StateNevada 1.428 1.554 1.691 0.043
## StateNew Hampshire 1.182 1.289 1.406 0.044
## StateNew Jersey 1.009 1.112 1.225 0.049
## StateNew Mexico 1.739 1.896 2.067 0.044
## StateNew York 0.729 0.785 0.845 0.038
## StateNorth Carolina 1.115 1.191 1.271 0.033
## StateNorth Dakota 0.309 0.348 0.392 0.060
## StateOhio 1.443 1.565 1.699 0.042
## StateOklahoma 1.328 1.469 1.626 0.052
## StateOregon 0.754 0.821 0.894 0.043
## StatePennsylvania 1.432 1.535 1.646 0.036
## StateRhode Island 1.137 1.280 1.441 0.060
## StateSouth Carolina 1.172 1.252 1.337 0.034
## StateSouth Dakota 0.348 0.384 0.425 0.051
## StateTennessee 1.456 1.556 1.663 0.034
## StateTexas 0.758 0.816 0.879 0.038
## StateUtah 0.944 1.079 1.234 0.068
## StateVermont 0.773 0.850 0.934 0.048
## StateVirginia 0.822 0.890 0.964 0.041
## StateWashington 0.982 1.073 1.173 0.045
## StateWest Virginia 2.181 2.399 2.638 0.048
## StateWisconsin 0.899 0.959 1.022 0.033
## StateWyoming 0.917 1.026 1.149 0.058
## Naloxone_Pharmacy_Yes_Redefined 0.921 0.970 1.022 0.027
## Naloxone_Pharmacy_No_Redefined 0.967 1.005 1.044 0.020
## Medical_Marijuana_Redefined 1.021 1.068 1.118 0.023
## Recreational_Marijuana_Redefined 0.917 0.961 1.008 0.024
## GSL_Redefined 0.992 1.036 1.082 0.022
## PDMP_Redefined 0.944 0.982 1.022 0.020
## Medicaid_Expansion_Redefined 1.069 1.106 1.144 0.017
## Intervention_Redefined 0.998 1.039 1.081 0.020
## num_states_w_intervention 0.992 1.003 1.014 0.006
## int_2_yr_effect 1.002 1.038 1.076 0.018
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.571 0.719 0.905 0.118
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.757 0.867 0.992 0.069
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.081 1.214 1.363 0.059
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.072 1.226 1.403 0.069
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.170 1.395 1.662 0.090
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.203 1.527 1.939 0.122
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.389 1.834 2.422 0.142
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.840 2.552 3.540 0.167
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.522 2.051 2.764 0.152
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.578 0.734 0.933 0.122
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.668 0.777 0.905 0.077
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.053 1.187 1.337 0.061
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.868 0.986 1.121 0.065
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.936 1.116 1.331 0.090
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.021 1.298 1.651 0.123
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.294 1.709 2.256 0.142
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.811 2.552 3.596 0.175
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.536 2.067 2.781 0.151
## s(Time_Period_ID):as.factor(Region)South.1 0.743 0.881 1.045 0.087
## s(Time_Period_ID):as.factor(Region)South.2 0.929 1.031 1.144 0.053
## s(Time_Period_ID):as.factor(Region)South.3 1.206 1.286 1.370 0.033
## s(Time_Period_ID):as.factor(Region)South.4 1.191 1.296 1.411 0.043
## s(Time_Period_ID):as.factor(Region)South.5 1.171 1.378 1.621 0.083
## s(Time_Period_ID):as.factor(Region)South.6 1.030 1.293 1.623 0.116
## s(Time_Period_ID):as.factor(Region)South.7 1.194 1.556 2.027 0.135
## s(Time_Period_ID):as.factor(Region)South.8 1.468 2.039 2.833 0.168
## s(Time_Period_ID):as.factor(Region)South.9 1.298 1.728 2.302 0.146
## s(Time_Period_ID):as.factor(Region)West.1 0.701 0.886 1.121 0.120
## s(Time_Period_ID):as.factor(Region)West.2 0.942 1.081 1.240 0.070
## s(Time_Period_ID):as.factor(Region)West.3 1.060 1.193 1.343 0.060
## s(Time_Period_ID):as.factor(Region)West.4 1.120 1.264 1.427 0.062
## s(Time_Period_ID):as.factor(Region)West.5 1.005 1.204 1.443 0.092
## s(Time_Period_ID):as.factor(Region)West.6 0.921 1.175 1.500 0.125
## s(Time_Period_ID):as.factor(Region)West.7 0.939 1.239 1.635 0.142
## s(Time_Period_ID):as.factor(Region)West.8 0.977 1.376 1.939 0.175
## s(Time_Period_ID):as.factor(Region)West.9 1.153 1.540 2.057 0.148
Plots
binnedplot(fitted(sensitivity_anlys_two_int_var_model), resid(sensitivity_anlys_two_int_var_model))

Compile Results
############## Sensitivity Analysis 7: Make Data Frame of Results and 95% CI ##########
#store the coefficients into the table
sensitivity_anlys_two_int_full_table<-sensitivity_anlys_two_int_var_sd_and_ci
#vector of covariates
covariates<-c("Naloxone_Pharmacy_Yes_Redefined",
"Naloxone_Pharmacy_No_Redefined",
"Medical_Marijuana_Redefined",
"Recreational_Marijuana_Redefined",
"GSL_Redefined",
"PDMP_Redefined",
"Medicaid_Expansion_Redefined",
"Intervention_Redefined",
"int_2_yr_effect",
"num_states_w_intervention")
#rename the variable names of the regression output so that they look nicer:
#currently there are 3 types of coefficients: state effects, the covariates, and smoothed time effects
#for each row in the main analysis table
for(i in 1:length(rownames(sensitivity_anlys_two_int_full_table))){
#if the coefficient is not in the covariates vector
if(!(rownames(sensitivity_anlys_two_int_full_table)[i] %in% covariates)){
#we see if it's a state effect
if(substr(rownames(sensitivity_anlys_two_int_full_table)[i], start = 1, stop = 5) == "State"){
#if so, here, the names look like: StateMassachusetts or StateGeorgia, so take out the "State" part
#and just rename these rows to just the state name
rownames(sensitivity_anlys_two_int_full_table)[i]<-substr(rownames(sensitivity_anlys_two_int_full_table)[i], start = 6,
stop = nchar(rownames(sensitivity_anlys_two_int_full_table)[i]))
}else if(rownames(sensitivity_anlys_two_int_full_table)[i] == "(Intercept)"){
#otherwise, if the current name is Intercept, we rename it so that we know that Alabama is the baseline
rownames(sensitivity_anlys_two_int_full_table)[i]<-"Intercept/Alabama"
}else if(substr(rownames(sensitivity_anlys_two_int_full_table)[i], start = 1, stop = 35) == "s(Time_Period_ID):as.factor(Region)"){
#otherwise, it's the smoothed time effects which look like: s(Time_Period_ID):as.factor(Region)West
#or s(Time_Period_ID):as.factor(Region)South, so we want to get rid of "s(Time_Period_ID):as.factor(Region)"
#and change it to "Smoothed Time for Region"
rownames(sensitivity_anlys_two_int_full_table)[i]<-paste("Smoothed Time for Region ",
substr(rownames(sensitivity_anlys_two_int_full_table)[i],
start = 36,
stop = nchar(rownames(sensitivity_anlys_two_int_full_table)[i])),
sep = "")
}
}
}
head(sensitivity_anlys_two_int_full_table)
## lb_coef coef_values ub_coef exp_lb
## Intercept/Alabama -10.22363692 -9.89980221 -9.57596750 3.630203e-05
## Alaska 0.17505430 0.27631218 0.37757007 1.191311e+00
## Arizona 0.24940420 0.31928115 0.38915809 1.283261e+00
## Arkansas -0.46341987 -0.37336524 -0.28331062 6.291284e-01
## California -0.24224361 -0.16108919 -0.07993477 7.848649e-01
## Colorado 0.01176385 0.09390593 0.17604801 1.011833e+00
## exp_coef exp_ub sd_coef
## Intercept/Alabama 5.018461e-05 6.937614e-05 0.16522179
## Alaska 1.318259e+00 1.458736e+00 0.05166218
## Arizona 1.376138e+00 1.475738e+00 0.03565150
## Arkansas 6.884138e-01 7.532858e-01 0.04594624
## California 8.512161e-01 9.231766e-01 0.04140532
## Colorado 1.098456e+00 1.192495e+00 0.04190923
tail(sensitivity_anlys_two_int_full_table)
## lb_coef coef_values ub_coef exp_lb
## Smoothed Time for Region West.4 0.113206466 0.2345509 0.3558952 1.1198631
## Smoothed Time for Region West.5 0.004746259 0.1858942 0.3670421 1.0047575
## Smoothed Time for Region West.6 -0.082572223 0.1615847 0.4057416 0.9207449
## Smoothed Time for Region West.7 -0.063340886 0.2142230 0.4917868 0.9386235
## Smoothed Time for Region West.8 -0.023585085 0.3193791 0.6623432 0.9766909
## Smoothed Time for Region West.9 0.142429868 0.4318265 0.7212231 1.1530722
## exp_coef exp_ub sd_coef
## Smoothed Time for Region West.4 1.264341 1.427458 0.0619104
## Smoothed Time for Region West.5 1.204295 1.443459 0.0924224
## Smoothed Time for Region West.6 1.175372 1.500415 0.1245699
## Smoothed Time for Region West.7 1.238899 1.635235 0.1416142
## Smoothed Time for Region West.8 1.376273 1.939331 0.1749817
## Smoothed Time for Region West.9 1.540068 2.056947 0.1476513
#export a table with just the covariates
#first, find the rows that contains the covariates
covariate_Index<-which(rownames(sensitivity_anlys_two_int_full_table) %in% covariates)
sensitivity_anlys_two_int_covariate_table<-(round(sensitivity_anlys_two_int_full_table[covariate_Index,], 5))
#rename the variables so that it looks cleaner
rownames(sensitivity_anlys_two_int_covariate_table)<-c("Naloxone_Pharmacy_Yes",
"Naloxone_Pharmacy_No",
"Medical_Marijuana",
"Recreational_Marijuana",
"GSL",
"PDMP",
"Medicaid_Expansion",
"Intervention",
"Number of States w Intervention",
"Two Year Intervention Effect")
#now, reorganize the data so that the covariates are on top and the rest of the variable sare below
sensitivity_anlys_two_int_covariate_table<-rbind(sensitivity_anlys_two_int_covariate_table,
sensitivity_anlys_two_int_full_table[-covariate_Index,])
#remove the columns that aren't in odds ratio scale
sensitivity_anlys_two_int_covariate_table<-sensitivity_anlys_two_int_covariate_table[,
-which(colnames(sensitivity_anlys_two_int_covariate_table) %in%
c("lb_coef",
"ub_coef",
"coef_values"))]
colnames(sensitivity_anlys_two_int_covariate_table)<-c("RR_95_CI_LB","Risk_Ratio_Estimates", "RR_95_CI_UB", "standard_error")
head(sensitivity_anlys_two_int_covariate_table, 10)
## RR_95_CI_LB Risk_Ratio_Estimates RR_95_CI_UB
## Naloxone_Pharmacy_Yes 0.92098 0.97028 1.02221
## Naloxone_Pharmacy_No 0.96673 1.00451 1.04377
## Medical_Marijuana 1.02084 1.06811 1.11757
## Recreational_Marijuana 0.91701 0.96148 1.00809
## GSL 0.99172 1.03606 1.08238
## PDMP 0.94378 0.98230 1.02240
## Medicaid_Expansion 1.06890 1.10580 1.14398
## Intervention 0.99778 1.03868 1.08126
## Number of States w Intervention 0.99210 1.00311 1.01424
## Two Year Intervention Effect 1.00204 1.03839 1.07604
## standard_error
## Naloxone_Pharmacy_Yes 0.02660
## Naloxone_Pharmacy_No 0.01956
## Medical_Marijuana 0.02309
## Recreational_Marijuana 0.02416
## GSL 0.02231
## PDMP 0.02041
## Medicaid_Expansion 0.01732
## Intervention 0.02050
## Number of States w Intervention 0.00563
## Two Year Intervention Effect 0.01818
#save the table into a CSV
# write.csv(round(sensitivity_anlys_two_int_covariate_table, 3), "./Data/coefficients_covariates_9_6_21_full_data_two_int.csv")
Attributable Deaths
################ Sensitivity Analysis 7: Number of Attributable Deaths ################
#first, we subset the data so that we only focus on the time points for which at least one state had the intervention
attr_deaths_anlys_two_int<-sensitivity_anlys_two_int_var[which(sensitivity_anlys_two_int_var$Intervention_Redefined>0),]
#compute the jacobian given a coefficient and treatment allocation
compute_jacobian <- function(population, prob, tx_vec_all, coef_all, tx_vec_two, coef_two, tx_vec_of_interest){
first_term <- -(population*(prob*exp(-tx_vec_all*coef_all - tx_vec_two*coef_two)*(-tx_vec_of_interest)))/
(1 + prob*(exp(-tx_vec_all*coef_all - tx_vec_two*coef_two) - 1))
second_term <- -(prob^2*exp(-tx_vec_all*coef_all - tx_vec_two*coef_two)^2*(-tx_vec_of_interest))/
(1 + prob*(exp(-tx_vec_all*coef_all - tx_vec_two*coef_two) - 1))^2
sum(c(first_term, second_term))
}
#compute the probability of overdose had intervention not occurred
prob_od_no_int_two_int<-expit(-coef(sensitivity_anlys_two_int_var_model)["int_2_yr_effect"]*
attr_deaths_anlys_two_int$int_2_yr_effect
-coef(sensitivity_anlys_two_int_var_model)["Intervention_Redefined"]*
attr_deaths_anlys_two_int$Intervention_Redefined
+ logit(attr_deaths_anlys_two_int$imputed_deaths/attr_deaths_anlys_two_int$population))
#variance-covariance matrix for the two intervention variables
vcov_interventions <- two_int_results[[2]][c("Intervention_Redefined", "int_2_yr_effect"),
c("Intervention_Redefined", "int_2_yr_effect")]
#estimate the number of deaths attributable to the intervention
#first, initialize the vectors to store the numbers
num_attr_od_UB<-num_attr_od_LB<-num_attr_od<-rep(NA, length(unique(sensitivity_anlys_two_int_var$Time_Period_ID)))
#for each time period, we first find the indices of rows containing data from that time point
#then, we find the total number of deaths that attributable to the intervention
index<-1 #keep track of where to store the values in the vector
for(time in sort(unique(attr_deaths_anlys_two_int$Time_Period_ID))){
#find the indices of rows where the time point = time
time_point_index<-which(attr_deaths_anlys_two_int$Time_Period_ID == time)
#find the number of deaths attributable to intervention = observed number of deaths with intervention - estimated number of deaths had intervention not occurred
num_attr_od[index]<-sum(attr_deaths_anlys_two_int$imputed_deaths[time_point_index]
- prob_od_no_int_two_int[time_point_index]*attr_deaths_anlys_two_int$population[time_point_index])
#compute the jacobian matrix
jacobian_mat <- matrix(c(compute_jacobian(attr_deaths_anlys_two_int$population[time_point_index],
attr_deaths_anlys_two_int$imputed_deaths[time_point_index]/
attr_deaths_anlys_two_int$population[time_point_index],
attr_deaths_anlys_two_int$Intervention_Redefined[time_point_index],
coef(sensitivity_anlys_two_int_var_model)["Intervention_Redefined"],
attr_deaths_anlys_two_int$int_2_yr_effect[time_point_index],
coef(sensitivity_anlys_two_int_var_model)["int_2_yr_effect"],
attr_deaths_anlys_two_int$Intervention_Redefined[time_point_index]),
compute_jacobian(attr_deaths_anlys_two_int$population[time_point_index],
attr_deaths_anlys_two_int$imputed_deaths[time_point_index]/
attr_deaths_anlys_two_int$population[time_point_index],
attr_deaths_anlys_two_int$Intervention_Redefined[time_point_index],
coef(sensitivity_anlys_two_int_var_model)["Intervention_Redefined"],
attr_deaths_anlys_two_int$int_2_yr_effect[time_point_index],
coef(sensitivity_anlys_two_int_var_model)["int_2_yr_effect"],
attr_deaths_anlys_two_int$int_2_yr_effect[time_point_index])),
nrow = 1, ncol = 2)
#compute the variance of attributable deaths for time t
var_n_attr <- tcrossprod(jacobian_mat%*%vcov_interventions, jacobian_mat)
#find the lower and upper bounds of the estimated number of deaths attributable to the intervention
num_attr_od_LB[index]<-num_attr_od[index] - 1.96*sqrt(var_n_attr)
num_attr_od_UB[index]<-num_attr_od[index] + 1.96*sqrt(var_n_attr)
index<-index + 1
}
num_attr_od_two_int<-data.frame("Time_Period_ID" = sort(unique(attr_deaths_anlys_two_int$Time_Period_ID)),
"Time_Start" = sort(unique(attr_deaths_anlys_two_int$Time_Period_Start)),
"Num_Attr_Deaths" = num_attr_od,
"Num_Attr_Deaths_LB" = num_attr_od_LB,
"Num_Attr_Deaths_UB" = num_attr_od_UB)
#sum up the total number of excess deaths attributable to the intervention
sum(num_attr_od_two_int$Num_Attr_Deaths)
## [1] 38340.3
#sum up the number of excess deaths per year
yearly_num_Attr_Deaths_two_int<-num_attr_od_two_int %>%
group_by("year" = year(Time_Start)) %>%
summarise("deaths" = sum(Num_Attr_Deaths),
death_lb = sum(Num_Attr_Deaths_LB),
death_ub = sum(Num_Attr_Deaths_UB))
summary(yearly_num_Attr_Deaths_two_int$deaths)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 36.26 750.89 1629.34 1917.02 2699.29 4426.09
summary(yearly_num_Attr_Deaths_two_int$death_lb)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 18.22 338.66 809.53 949.07 1348.19 2230.68
summary(yearly_num_Attr_Deaths_two_int$death_ub)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 54.31 1169.32 2449.16 2884.96 4050.38 6621.49
ggplot(yearly_num_Attr_Deaths_two_int, aes(x = year, y = deaths)) +
geom_line() +
geom_line(aes(x = year, y = death_lb), linetype = "dashed") +
geom_line(aes(x = year, y = death_ub), linetype = "dashed") +
geom_point()

Sensitivity Analysis 9: Including Number of DIH Prosecutions as Covariate
Analysis
########### Sensitivity Analysis 9: Number of DIH prosecutions as Covariate ######################
#create a plot for each state to see how many prosecution media alerts there are per 6 month period
#read in the prosecution media alert data
prosecution_data<-read.csv("./Data/dih_prosecutions_9_6_21.csv")
#data cleaning
prosecution_data<-prosecution_data %>%
mutate(Date = as.Date(Date.charged, "%m/%d/%Y")) %>%
mutate(State = ifelse(State.Filed == "pennsylvania", "Pennsylvania", State.Filed),
State = ifelse(State.Filed == "Virginia ", "Virginia", State)) %>%
filter(!is.na(Date), State.Filed != "No Info", State.Filed != "No info", State.Filed != "No Info ",
State != "")
#clean up the data by looking at the link to the article
prosecution_data$Date[prosecution_data$Date == "2026-08-01"] <- as.Date("2016-02-15", "%Y-%m-%d")
#change the states into Character instead of factor
prosecution_data$State<-as.character(prosecution_data$State)
#see how many prosecution data points there are for each state
table(prosecution_data$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 76
Colorado Connecticut Delaware Florida Georgia
32 47 3 138 29
Idaho Illinois Indiana Iowa Kansas
9 342 55 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 63 34
Michigan Minnesota Mississippi Missouri Montana
116 140 1 45 11
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 137 4
New York North Carolina North Dakota Ohio Oklahoma
110 124 53 404 41
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 726 2 12 13
Tennessee Texas Utah Vermont Virginia
94 44 21 13 63
Washington West Virginia Wisconsin Wyoming
78 33 381 19
#there are some repeated cases depending on victim
prosecution_data_unique <- prosecution_data %>%
group_by(State) %>%
distinct(Accused.Name, Date, .keep_all = T)
table(prosecution_data_unique$State)
Alabama Alaska Arizona Arkansas California
12 8 9 4 72
Colorado Connecticut Delaware Florida Georgia
30 46 3 134 26
Idaho Illinois Indiana Iowa Kansas
9 336 53 31 9
Kentucky Louisiana Maine Maryland Massachusetts
43 65 17 62 34
Michigan Minnesota Mississippi Missouri Montana
114 140 1 44 10
Nebraska Nevada New Hampshire New Jersey New Mexico
1 13 42 131 4
New York North Carolina North Dakota Ohio Oklahoma
105 121 40 395 34
Oregon Pennsylvania Rhode Island South Carolina South Dakota
19 718 2 12 13
Tennessee Texas Utah Vermont Virginia
94 43 21 13 63
Washington West Virginia Wisconsin Wyoming
75 33 373 19
#change date charged into Date object
prosecution_data_unique$Date<-mdy(prosecution_data_unique$Date.charged)
#group the data into six month periods
prosecution_data_unique<-prosecution_data_unique %>%
mutate(six_month_pd = lubridate::floor_date(Date , "6 months" ))
#count the number of prosecution media alerts in each six month period
#we also get the first and last date of prosecution in time period
prosecution_data_by_six_month_pd <- prosecution_data_unique %>%
filter(year(six_month_pd)>1999 & year(six_month_pd)<2020) %>%
group_by(State, six_month_pd) %>%
summarise(first_date_in_pd = min(Date),
last_date_in_pd = max(Date),
num_int = n()) #sums up number of prosecutions per state/time combination
#create the data set used for this sensitivity analysis
#first, we merge the grouped prosecution data set with the main data set by state and time period
sensitivity_anlys_num_int_data<-merge(main_analysis_data,
prosecution_data_by_six_month_pd,
by.x = c("State", "Time_Period_Start"),
by.y = c("State", "six_month_pd"), all.x = TRUE)
#then we fill in the missing entries of num_int with 0
#we also initalize number of states with intervention
sensitivity_anlys_num_int_data <- sensitivity_anlys_num_int_data %>%
mutate(num_int = ifelse(is.na(num_int), 0, num_int),
num_states_w_intervention = 0)
#we compute the number of states with intervention
for(time in unique(sensitivity_anlys_num_int_data$Time_Period_ID)){
num_states_w_int <- length(sensitivity_anlys_num_int_data$State[sensitivity_anlys_num_int_data$Time_Period_ID == time &
sensitivity_anlys_num_int_data$num_int > 0])
sensitivity_anlys_num_int_data$num_states_w_intervention[sensitivity_anlys_num_int_data$Time_Period_ID == time] <- num_states_w_int
}
#run the analysis on the sensitivity analysis data
sensitivity_anlys_num_int_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
num_int +
num_states_w_intervention,
data = sensitivity_anlys_num_int_data, family = "binomial")
stargazer(sensitivity_anlys_num_int_model, type = "html", dep.var.labels = "Unintentional Overdose Death")
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Death
|
|
|
|
StateAlaska
|
0.249***
|
|
|
(0.027)
|
|
|
|
|
StateArizona
|
0.299***
|
|
|
(0.014)
|
|
|
|
|
StateArkansas
|
-0.402***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
-0.146***
|
|
|
(0.013)
|
|
|
|
|
StateColorado
|
0.085***
|
|
|
(0.016)
|
|
|
|
|
StateConnecticut
|
0.189***
|
|
|
(0.016)
|
|
|
|
|
StateDelaware
|
0.401***
|
|
|
(0.022)
|
|
|
|
|
StateFlorida
|
0.268***
|
|
|
(0.012)
|
|
|
|
|
StateGeorgia
|
-0.054***
|
|
|
(0.013)
|
|
|
|
|
StateHawaii
|
-0.271***
|
|
|
(0.025)
|
|
|
|
|
StateIdaho
|
-0.161***
|
|
|
(0.024)
|
|
|
|
|
StateIllinois
|
-0.004
|
|
|
(0.013)
|
|
|
|
|
StateIndiana
|
0.083***
|
|
|
(0.014)
|
|
|
|
|
StateIowa
|
-0.733***
|
|
|
(0.021)
|
|
|
|
|
StateKansas
|
-0.326***
|
|
|
(0.019)
|
|
|
|
|
StateKentucky
|
0.629***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.302***
|
|
|
(0.014)
|
|
|
|
|
StateMaine
|
0.145***
|
|
|
(0.022)
|
|
|
|
|
StateMaryland
|
-1.055***
|
|
|
(0.019)
|
|
|
|
|
StateMassachusetts
|
0.208***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.013
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.616***
|
|
|
(0.017)
|
|
|
|
|
StateMississippi
|
-0.119***
|
|
|
(0.018)
|
|
|
|
|
StateMissouri
|
0.203***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.349***
|
|
|
(0.029)
|
|
|
|
|
StateNebraska
|
-0.895***
|
|
|
(0.028)
|
|
|
|
|
StateNevada
|
0.445***
|
|
|
(0.017)
|
|
|
|
|
StateNew Hampshire
|
0.253***
|
|
|
(0.020)
|
|
|
|
|
StateNew Jersey
|
0.117***
|
|
|
(0.013)
|
|
|
|
|
StateNew Mexico
|
0.625***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.237***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Carolina
|
0.185***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.064***
|
|
|
(0.045)
|
|
|
|
|
StateOhio
|
0.467***
|
|
|
(0.012)
|
|
|
|
|
StateOklahoma
|
0.376***
|
|
|
(0.015)
|
|
|
|
|
StateOregon
|
-0.200***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.445***
|
|
|
(0.013)
|
|
|
|
|
StateRhode Island
|
0.224***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.195***
|
|
|
(0.014)
|
|
|
|
|
StateSouth Dakota
|
-0.988***
|
|
|
(0.042)
|
|
|
|
|
StateTennessee
|
0.437***
|
|
|
(0.013)
|
|
|
|
|
StateTexas
|
-0.190***
|
|
|
(0.012)
|
|
|
|
|
StateUtah
|
0.080***
|
|
|
(0.018)
|
|
|
|
|
StateVermont
|
-0.168***
|
|
|
(0.031)
|
|
|
|
|
StateVirginia
|
-0.102***
|
|
|
(0.014)
|
|
|
|
|
StateWashington
|
0.074***
|
|
|
(0.015)
|
|
|
|
|
StateWest Virginia
|
0.860***
|
|
|
(0.015)
|
|
|
|
|
StateWisconsin
|
-0.027*
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.016
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.026***
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.008
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.061***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.035***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.032***
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.019***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.104***
|
|
|
(0.006)
|
|
|
|
|
num_int
|
0.0001
|
|
|
(0.0002)
|
|
|
|
|
num_states_w_intervention
|
-0.001*
|
|
|
(0.001)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-9.749***
|
|
|
(0.015)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.910
|
|
Log Likelihood
|
-16,819.910
|
|
UBRE
|
8.909
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#here, we estimate the variance-covariance matrix through the sandwich estimator
#we obtain the full covariance matrix with smoothed terms
sensitivity_anlys_num_int_w_basis_functions <- data.frame(predict(sensitivity_anlys_num_int_model, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_num_int_coefficient_values <- coef(sensitivity_anlys_num_int_model)
#type = "response" to get the estimated probabilities
sensitivity_anlys_num_int_pred_prob <- predict(sensitivity_anlys_num_int_model,
newdata = sensitivity_anlys_num_int_data, type = "response")
sensitivity_anlys_num_int_sd_and_ci <- compute_sd_and_CI(sensitivity_anlys_num_int_w_basis_functions,
sensitivity_anlys_num_int_data$population,
sensitivity_anlys_num_int_data$imputed_deaths,
sensitivity_anlys_num_int_pred_prob,
sensitivity_anlys_num_int_coefficient_values)
round(sensitivity_anlys_num_int_sd_and_ci, 4)
## lb_coef coef_values ub_coef
## (Intercept) -9.8378 -9.7489 -9.6599
## StateAlaska 0.1502 0.2493 0.3485
## StateArizona 0.2269 0.2993 0.3718
## StateArkansas -0.4926 -0.4019 -0.3112
## StateCalifornia -0.2279 -0.1456 -0.0633
## StateColorado 0.0011 0.0851 0.1690
## StateConnecticut 0.1061 0.1895 0.2729
## StateDelaware 0.2670 0.4009 0.5349
## StateFlorida 0.1921 0.2680 0.3438
## StateGeorgia -0.1218 -0.0545 0.0128
## StateHawaii -0.3689 -0.2709 -0.1729
## StateIdaho -0.2503 -0.1614 -0.0725
## StateIllinois -0.0937 -0.0043 0.0852
## StateIndiana 0.0106 0.0835 0.1563
## StateIowa -0.8200 -0.7334 -0.6467
## StateKansas -0.4225 -0.3258 -0.2291
## StateKentucky 0.5555 0.6290 0.7024
## StateLouisiana 0.2282 0.3024 0.3766
## StateMaine 0.0481 0.1450 0.2420
## StateMaryland -1.2675 -1.0549 -0.8424
## StateMassachusetts 0.1025 0.2084 0.3142
## StateMichigan -0.0862 -0.0128 0.0606
## StateMinnesota -0.6987 -0.6163 -0.5339
## StateMississippi -0.1968 -0.1193 -0.0417
## StateMissouri 0.1257 0.2026 0.2796
## StateMontana -0.4391 -0.3490 -0.2589
## StateNebraska -0.9902 -0.8949 -0.7996
## StateNevada 0.3581 0.4447 0.5312
## StateNew Hampshire 0.1642 0.2535 0.3427
## StateNew Jersey 0.0184 0.1173 0.2161
## StateNew Mexico 0.5378 0.6251 0.7123
## StateNew York -0.3116 -0.2371 -0.1625
## StateNorth Carolina 0.1181 0.1852 0.2523
## StateNorth Dakota -1.1856 -1.0640 -0.9424
## StateOhio 0.3870 0.4671 0.5471
## StateOklahoma 0.2760 0.3760 0.4760
## StateOregon -0.2859 -0.2001 -0.1143
## StatePennsylvania 0.3688 0.4452 0.5215
## StateRhode Island 0.1053 0.2242 0.3431
## StateSouth Carolina 0.1277 0.1955 0.2632
## StateSouth Dakota -1.0849 -0.9883 -0.8917
## StateTennessee 0.3674 0.4368 0.5063
## StateTexas -0.2672 -0.1903 -0.1134
## StateUtah -0.0559 0.0795 0.2150
## StateVermont -0.2630 -0.1684 -0.0738
## StateVirginia -0.1814 -0.1020 -0.0227
## StateWashington -0.0152 0.0742 0.1635
## StateWest Virginia 0.7619 0.8598 0.9577
## StateWisconsin -0.0964 -0.0275 0.0415
## StateWyoming -0.0983 0.0162 0.1306
## Naloxone_Pharmacy_Yes_Redefined -0.0784 -0.0263 0.0258
## Naloxone_Pharmacy_No_Redefined -0.0311 0.0082 0.0475
## Medical_Marijuana_Redefined 0.0175 0.0611 0.1048
## Recreational_Marijuana_Redefined -0.0839 -0.0352 0.0136
## GSL_Redefined -0.0118 0.0324 0.0767
## PDMP_Redefined -0.0593 -0.0190 0.0213
## Medicaid_Expansion_Redefined 0.0706 0.1044 0.1382
## num_int -0.0016 0.0001 0.0018
## num_states_w_intervention -0.0046 -0.0010 0.0027
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.5687 -0.3985 -0.2282
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.2855 -0.1790 -0.0726
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.0856 0.1982 0.3108
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.1234 0.2389 0.3544
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.3126 0.4077 0.5028
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.4238 0.5226 0.6214
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.6037 0.7201 0.8364
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.9327 1.0778 1.2229
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.7156 0.8295 0.9433
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.5530 -0.3671 -0.1813
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.4136 -0.2805 -0.1474
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.0486 0.1632 0.2777
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.0879 0.0268 0.1415
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.0876 0.1857 0.2838
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.2610 0.3605 0.4600
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.5383 0.6582 0.7781
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.9326 1.0850 1.2375
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.7073 0.8426 0.9778
## s(Time_Period_ID):as.factor(Region)South.1 -0.2813 -0.1831 -0.0849
## s(Time_Period_ID):as.factor(Region)South.2 -0.0646 -0.0018 0.0610
## s(Time_Period_ID):as.factor(Region)South.3 0.1789 0.2419 0.3049
## s(Time_Period_ID):as.factor(Region)South.4 0.2347 0.2906 0.3465
## s(Time_Period_ID):as.factor(Region)South.5 0.3284 0.3897 0.4510
## s(Time_Period_ID):as.factor(Region)South.6 0.2828 0.3537 0.4245
## s(Time_Period_ID):as.factor(Region)South.7 0.4711 0.5629 0.6547
## s(Time_Period_ID):as.factor(Region)South.8 0.7429 0.8633 0.9836
## s(Time_Period_ID):as.factor(Region)South.9 0.5608 0.6655 0.7702
## s(Time_Period_ID):as.factor(Region)West.1 -0.3548 -0.1695 0.0159
## s(Time_Period_ID):as.factor(Region)West.2 -0.0686 0.0378 0.1442
## s(Time_Period_ID):as.factor(Region)West.3 0.0464 0.1646 0.2828
## s(Time_Period_ID):as.factor(Region)West.4 0.1602 0.2681 0.3759
## s(Time_Period_ID):as.factor(Region)West.5 0.1466 0.2586 0.3706
## s(Time_Period_ID):as.factor(Region)West.6 0.1549 0.2699 0.3849
## s(Time_Period_ID):as.factor(Region)West.7 0.2115 0.3356 0.4598
## s(Time_Period_ID):as.factor(Region)West.8 0.3133 0.4706 0.6280
## s(Time_Period_ID):as.factor(Region)West.9 0.4328 0.5504 0.6679
## exp_lb exp_coef exp_ub sd_coef
## (Intercept) 0.0001 0.0001 0.0001 0.0454
## StateAlaska 1.1620 1.2832 1.4169 0.0506
## StateArizona 1.2547 1.3490 1.4503 0.0369
## StateArkansas 0.6110 0.6691 0.7326 0.0463
## StateCalifornia 0.7962 0.8645 0.9387 0.0420
## StateColorado 1.0011 1.0888 1.1841 0.0428
## StateConnecticut 1.1119 1.2086 1.3138 0.0426
## StateDelaware 1.3061 1.4932 1.7072 0.0683
## StateFlorida 1.2118 1.3073 1.4103 0.0387
## StateGeorgia 0.8853 0.9470 1.0129 0.0343
## StateHawaii 0.6915 0.7627 0.8412 0.0500
## StateIdaho 0.7786 0.8510 0.9301 0.0454
## StateIllinois 0.9105 0.9957 1.0890 0.0457
## StateIndiana 1.0107 1.0870 1.1692 0.0372
## StateIowa 0.4404 0.4803 0.5238 0.0442
## StateKansas 0.6554 0.7219 0.7952 0.0493
## StateKentucky 1.7428 1.8756 2.0187 0.0375
## StateLouisiana 1.2564 1.3531 1.4572 0.0378
## StateMaine 1.0493 1.1561 1.2737 0.0494
## StateMaryland 0.2815 0.3482 0.4307 0.1084
## StateMassachusetts 1.1079 1.2316 1.3692 0.0540
## StateMichigan 0.9174 0.9873 1.0625 0.0375
## StateMinnesota 0.4972 0.5399 0.5863 0.0420
## StateMississippi 0.8214 0.8876 0.9591 0.0396
## StateMissouri 1.1340 1.2246 1.3225 0.0392
## StateMontana 0.6446 0.7054 0.7719 0.0460
## StateNebraska 0.3715 0.4086 0.4495 0.0486
## StateNevada 1.4307 1.5600 1.7010 0.0442
## StateNew Hampshire 1.1785 1.2885 1.4088 0.0455
## StateNew Jersey 1.0186 1.1244 1.2412 0.0504
## StateNew Mexico 1.7122 1.8684 2.0387 0.0445
## StateNew York 0.7323 0.7889 0.8500 0.0380
## StateNorth Carolina 1.1254 1.2035 1.2870 0.0342
## StateNorth Dakota 0.3056 0.3451 0.3897 0.0620
## StateOhio 1.4726 1.5953 1.7283 0.0408
## StateOklahoma 1.3179 1.4565 1.6096 0.0510
## StateOregon 0.7514 0.8187 0.8920 0.0438
## StatePennsylvania 1.4460 1.5607 1.6846 0.0390
## StateRhode Island 1.1111 1.2513 1.4093 0.0607
## StateSouth Carolina 1.1362 1.2159 1.3011 0.0346
## StateSouth Dakota 0.3379 0.3722 0.4100 0.0493
## StateTennessee 1.4440 1.5478 1.6591 0.0354
## StateTexas 0.7655 0.8267 0.8928 0.0392
## StateUtah 0.9456 1.0828 1.2399 0.0691
## StateVermont 0.7688 0.8450 0.9289 0.0483
## StateVirginia 0.8341 0.9030 0.9776 0.0405
## StateWashington 0.9849 1.0770 1.1776 0.0456
## StateWest Virginia 2.1424 2.3627 2.6057 0.0499
## StateWisconsin 0.9081 0.9729 1.0423 0.0352
## StateWyoming 0.9064 1.0163 1.1396 0.0584
## Naloxone_Pharmacy_Yes_Redefined 0.9246 0.9741 1.0262 0.0266
## Naloxone_Pharmacy_No_Redefined 0.9694 1.0082 1.0487 0.0201
## Medical_Marijuana_Redefined 1.0177 1.0631 1.1105 0.0223
## Recreational_Marijuana_Redefined 0.9195 0.9655 1.0137 0.0249
## GSL_Redefined 0.9883 1.0330 1.0797 0.0226
## PDMP_Redefined 0.9424 0.9812 1.0215 0.0206
## Medicaid_Expansion_Redefined 1.0731 1.1100 1.1482 0.0172
## num_int 0.9984 1.0001 1.0018 0.0009
## num_states_w_intervention 0.9954 0.9990 1.0027 0.0019
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.5662 0.6713 0.7959 0.0869
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.7517 0.8361 0.9300 0.0543
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.0893 1.2192 1.3646 0.0575
## s(Time_Period_ID):as.factor(Region)Midwest.4 1.1313 1.2698 1.4253 0.0589
## s(Time_Period_ID):as.factor(Region)Midwest.5 1.3670 1.5034 1.6533 0.0485
## s(Time_Period_ID):as.factor(Region)Midwest.6 1.5277 1.6864 1.8616 0.0504
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.8290 2.0546 2.3080 0.0593
## s(Time_Period_ID):as.factor(Region)Midwest.8 2.5413 2.9382 3.3970 0.0740
## s(Time_Period_ID):as.factor(Region)Midwest.9 2.0455 2.2921 2.5684 0.0581
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.5752 0.6927 0.8342 0.0948
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.6613 0.7554 0.8629 0.0679
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.0498 1.1773 1.3201 0.0584
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.9159 1.0272 1.1520 0.0585
## s(Time_Period_ID):as.factor(Region)Northeast.5 1.0916 1.2041 1.3282 0.0501
## s(Time_Period_ID):as.factor(Region)Northeast.6 1.2982 1.4341 1.5841 0.0508
## s(Time_Period_ID):as.factor(Region)Northeast.7 1.7130 1.9313 2.1773 0.0612
## s(Time_Period_ID):as.factor(Region)Northeast.8 2.5411 2.9595 3.4469 0.0778
## s(Time_Period_ID):as.factor(Region)Northeast.9 2.0286 2.3224 2.6587 0.0690
## s(Time_Period_ID):as.factor(Region)South.1 0.7548 0.8327 0.9186 0.0501
## s(Time_Period_ID):as.factor(Region)South.2 0.9375 0.9982 1.0629 0.0320
## s(Time_Period_ID):as.factor(Region)South.3 1.1959 1.2737 1.3565 0.0321
## s(Time_Period_ID):as.factor(Region)South.4 1.2646 1.3372 1.4141 0.0285
## s(Time_Period_ID):as.factor(Region)South.5 1.3887 1.4765 1.5698 0.0313
## s(Time_Period_ID):as.factor(Region)South.6 1.3268 1.4243 1.5289 0.0362
## s(Time_Period_ID):as.factor(Region)South.7 1.6017 1.7557 1.9245 0.0468
## s(Time_Period_ID):as.factor(Region)South.8 2.1020 2.3709 2.6741 0.0614
## s(Time_Period_ID):as.factor(Region)South.9 1.7521 1.9455 2.1603 0.0534
## s(Time_Period_ID):as.factor(Region)West.1 0.7013 0.8441 1.0160 0.0946
## s(Time_Period_ID):as.factor(Region)West.2 0.9337 1.0385 1.1551 0.0543
## s(Time_Period_ID):as.factor(Region)West.3 1.0475 1.1789 1.3268 0.0603
## s(Time_Period_ID):as.factor(Region)West.4 1.1738 1.3074 1.4563 0.0550
## s(Time_Period_ID):as.factor(Region)West.5 1.1579 1.2951 1.4486 0.0571
## s(Time_Period_ID):as.factor(Region)West.6 1.1676 1.3098 1.4694 0.0587
## s(Time_Period_ID):as.factor(Region)West.7 1.2355 1.3988 1.5837 0.0633
## s(Time_Period_ID):as.factor(Region)West.8 1.3679 1.6010 1.8739 0.0803
## s(Time_Period_ID):as.factor(Region)West.9 1.5416 1.7339 1.9502 0.0600
Sensitivity Analysis 10: Including Unemployment Rates and Age Groups
Clean Data
#create age groups using the population dataset
pop_by_age_2010<- read.csv("./Data/pop_by_age_state_2000_2010.csv")
head(pop_by_age_2010)
## REGION DIVISION STATE NAME SEX AGE ESTIMATESBASE2000 POPESTIMATE2000
## 1 0 0 0 United States 0 0 3805718 3855956
## 2 0 0 0 United States 0 1 3820647 3798691
## 3 0 0 0 United States 0 2 3790534 3800144
## 4 0 0 0 United States 0 3 3832855 3821118
## 5 0 0 0 United States 0 4 3926400 3902384
## 6 0 0 0 United States 0 5 3965175 3967834
## POPESTIMATE2001 POPESTIMATE2002 POPESTIMATE2003 POPESTIMATE2004
## 1 4012658 3951461 3975871 4014258
## 2 3855407 4004674 3936139 3953063
## 3 3800096 3856114 4002836 3933735
## 4 3802710 3804336 3860727 4008220
## 5 3827346 3812607 3816873 3876609
## 6 3910033 3837187 3823568 3829607
## POPESTIMATE2005 POPESTIMATE2006 POPESTIMATE2007 POPESTIMATE2008
## 1 4004393 4041738 4147997 4132735
## 2 3987032 3972124 4002215 4100756
## 3 3952632 3988119 3973479 4004146
## 4 3943215 3966022 4004011 3992320
## 5 4030128 3970880 3998260 4041170
## 6 3893128 4050582 3993489 4024297
## POPESTIMATE2009 CENSUS2010POP POPESTIMATE2010
## 1 4003587 3944153 3952444
## 2 4078797 3978070 3951024
## 3 4103002 4096929 4087074
## 4 4025675 4119040 4133855
## 5 4033457 4063170 4076132
## 6 4070265 4056858 4069577
#base the age groups on abouk, powell, pacula
#age groups: 0 - 17, 18 - 34, 35 - 54, 65+
pop_by_age_2010_group <- pop_by_age_2010 %>%
#999 indicates total population
filter(AGE < 999, AGE >= 18) %>%
#create age groups
mutate(age_groups = ifelse(AGE >= 18 & AGE <= 24, "18_24",
ifelse(AGE >= 25 & AGE <= 34, "25_34",
ifelse(AGE >= 35 & AGE <= 44, "35_44",
ifelse(AGE >= 45 & AGE <= 64, "45_64", "65_plus"))))) %>%
#we filter according to how the DIH prosecutions were filtered, excluding cases with minors
filter(NAME != "United States", SEX == 0) %>%
group_by(NAME, age_groups) %>%
summarise(pop_2000 = sum(ESTIMATESBASE2000),
pop_2001 = sum(POPESTIMATE2001),
pop_2002 = sum(POPESTIMATE2002),
pop_2003 = sum(POPESTIMATE2003),
pop_2004 = sum(POPESTIMATE2004),
pop_2005 = sum(POPESTIMATE2005),
pop_2006 = sum(POPESTIMATE2006),
pop_2007 = sum(POPESTIMATE2007),
pop_2008 = sum(POPESTIMATE2008),
pop_2009 = sum(POPESTIMATE2009),
pop_2010 = sum(CENSUS2010POP))
#also make distribution of each age group
#define proportion function
#calculate the proportion of the age group for each state, year
prop <- function(x){x/sum(x)}
pop_by_age_2010_group <- pop_by_age_2010_group %>%
group_by(NAME) %>%
mutate_if(is.numeric, prop)
pop_by_age_2019 <- read.csv("./Data/pop_by_age_state_2010_2019.csv")
head(pop_by_age_2019)
## SUMLEV REGION DIVISION STATE NAME SEX AGE ESTBASE2010_CIV
## 1 10 0 0 0 United States 0 0 3944160
## 2 10 0 0 0 United States 0 1 3978090
## 3 10 0 0 0 United States 0 2 4096939
## 4 10 0 0 0 United States 0 3 4119051
## 5 10 0 0 0 United States 0 4 4063186
## 6 10 0 0 0 United States 0 5 4056872
## POPEST2010_CIV POPEST2011_CIV POPEST2012_CIV POPEST2013_CIV POPEST2014_CIV
## 1 3951430 3963092 3926570 3931258 3954787
## 2 3957730 3966225 3977549 3942698 3948891
## 3 4090621 3970654 3978925 3991740 3958711
## 4 4111688 4101644 3981531 3991017 4005928
## 5 4077346 4121488 4111490 3992502 4004032
## 6 4064521 4087054 4131049 4121876 4004576
## POPEST2015_CIV POPEST2016_CIV POPEST2017_CIV POPEST2018_CIV POPEST2019_CIV
## 1 3983981 3954773 3893990 3815343 3783052
## 2 3973133 4002903 3972711 3908830 3829599
## 3 3966321 3991349 4020045 3987032 3922044
## 4 3974351 3982984 4006946 4033038 3998665
## 5 4020292 3989750 3997280 4018719 4043323
## 6 4017589 4035033 4003452 4008443 4028281
pop_by_age_2019_group <- pop_by_age_2019 %>%
#999 indicates total population
filter(AGE < 999, AGE >= 18) %>%
#create age groups
mutate(age_groups = ifelse(AGE >= 18 & AGE <= 24, "18_24",
ifelse(AGE >= 25 & AGE <= 34, "25_34",
ifelse(AGE >= 35 & AGE <= 44, "35_44",
ifelse(AGE >= 45 & AGE <= 64, "45_64", "65_plus"))))) %>%
filter(NAME != "United States", SEX == 0) %>%
group_by(NAME, age_groups) %>%
summarise(pop_2011 = sum(POPEST2011_CIV),
pop_2012 = sum(POPEST2012_CIV),
pop_2013 = sum(POPEST2013_CIV),
pop_2014 = sum(POPEST2014_CIV),
pop_2015 = sum(POPEST2015_CIV),
pop_2016 = sum(POPEST2016_CIV),
pop_2017 = sum(POPEST2017_CIV),
pop_2018 = sum(POPEST2018_CIV),
pop_2019 = sum(POPEST2019_CIV))
#calculate the proportion of the age group for each year, state
pop_by_age_2019_group <- pop_by_age_2019_group %>%
group_by(NAME) %>%
mutate_if(is.numeric, prop)
#combine the population and unemployment data to the main analysis dataset
population_prop_data <- merge(pop_by_age_2010_group, pop_by_age_2019_group, by = c("NAME", "age_groups"))
#change the population and unemployment dataset from wide to long
population_prop_data_long <- population_prop_data %>%
pivot_longer(
#change the cols that start with "pop"
cols = starts_with("pop"),
#put the column names into a col named "year"
names_to = "year",
#put the values into a col names "population_prop"
values_to = "population_prop",
#delete the "pop_" from the column names
names_prefix = "pop_"
)
#now we want to pivot the table to wider so that each age_group population share is a column
population_prop_data_final <- population_prop_data_long %>%
pivot_wider(
#each row identified by state and year
id_cols = c("NAME", "year"),
#take the column names from the age groups
names_from = age_groups,
#take the values from the population proportion column
values_from = population_prop,
#add "pop_prop_" to the col names
names_prefix = "pop_prop_"
)
#skip the first three rows because that is the header
#the series ID corresponds to the different states in order, so have to rename the IDs -- checked this manually 11/29/21
#we manually retrieved the data from BLS to get seasonally adjusted unemployment rates for each state
unemployment_rate <- readxl::read_excel("./Data/bls_unemployment_rate_2000_2019.xlsx", skip = 3)
unemployment_rate <- unemployment_rate %>%
mutate(State = unique(main_analysis_data$State))
#change dataset from wide to long
unemployment_rate_long <- unemployment_rate %>%
pivot_longer(
cols = is.numeric,
#add column for the date
names_to = "time",
#add column where values are the unemployment rate
values_to = "unemployment_rate"
) %>%
#remove the columns which are not needed or are all NA
dplyr::select(-`Series ID`,
-`Nov\n2021` ,
-`Dec\n2021`) %>%
#change date to date object
mutate(time = mdy(time)) %>%
#filter to only keep date up to 2019
filter(year(time) <= 2019)
#since we need 6 month groupings, we take the average per 6 month and state
unemployment_rate_summary <- unemployment_rate_long %>%
#compute the six month period for each date
mutate(six_month_pd = floor_date(time, unit = "6 months")) %>%
#group by state and six month period
group_by(State, six_month_pd) %>%
#compute the mean unemployment rate
summarise(mean_unemployment = mean(unemployment_rate/100))
#finally merge the two datasets into the main analysis dataset
#first create a temporary main analysis data with a year column
main_analysis_data_w_year <- main_analysis_data %>%
mutate(year = year(Time_Period_Start))
#merge the age group proportion data
sensitivity_anlys_age_gp_unemp <- merge(main_analysis_data_w_year, population_prop_data_final,
by.x = c("State", "year"), by.y = c("NAME", "year"))
#merge the unemployment rate
sensitivity_anlys_age_gp_unemp <- merge(sensitivity_anlys_age_gp_unemp, unemployment_rate_summary,
by.x = c("State", "Time_Period_Start"), by.y = c("State", "six_month_pd"))
#remove the year column
sensitivity_anlys_age_gp_unemp <- sensitivity_anlys_age_gp_unemp %>%
dplyr::select(-year) %>%
mutate(mean_unemployment = mean_unemployment)
Quick EDA
#do an EDA to check drug overdoses by age group and unemployment rate
ggplot(sensitivity_anlys_age_gp_unemp) +
geom_line(aes(y = imputed_deaths/population, x = pop_prop_18_24, color = "18_24")) +
geom_line(aes(y = imputed_deaths/population, x = pop_prop_25_34, color = "25_34")) +
geom_line(aes(y = imputed_deaths/population, x = pop_prop_35_44, color = "35_44")) +
geom_line(aes(y = imputed_deaths/population, x = pop_prop_45_64, color = "45_64")) +
geom_line(aes(y = imputed_deaths/population, x = pop_prop_65_plus, color = "65+")) +
facet_wrap(~State)

ggplot(sensitivity_anlys_age_gp_unemp) +
geom_line( aes(y = (imputed_deaths/population)*100, x = Time_Period_Start, color = "od_rate", group = 1)) +
geom_line( aes(y = mean_unemployment, x = Time_Period_Start, color = "unemp", group = 1)) +
facet_wrap(~State)

############################## Run Model with Spline Time Effects by Region ###############################
#model that we will be using for the main analysis
#cr is used for cubic regression spline -- we are smoothing time effects by region
#run the analysis for all the states
sensitivity_anlys_age_unemp_model<-gam(cbind(round(imputed_deaths), round(num_alive))~ State +
s(Time_Period_ID, bs = "cr", by = as.factor(Region)) +
Naloxone_Pharmacy_Yes_Redefined +
Naloxone_Pharmacy_No_Redefined +
Medical_Marijuana_Redefined +
Recreational_Marijuana_Redefined +
GSL_Redefined +
PDMP_Redefined +
Medicaid_Expansion_Redefined +
Intervention_Redefined +
num_states_w_intervention +
mean_unemployment +
pop_prop_25_34 +
pop_prop_35_44 +
pop_prop_45_64 +
pop_prop_65_plus,
data = sensitivity_anlys_age_gp_unemp,
family = "binomial")
# summary(sensitivity_anlys_age_unemp_model)
#summary output of the model
stargazer(sensitivity_anlys_age_unemp_model, type = "html", dep.var.labels = c("Unintentional Overdose Deaths"))
|
|
|
|
Dependent variable:
|
|
|
|
|
|
Unintentional Overdose Deaths
|
|
|
|
StateAlaska
|
0.670***
|
|
|
(0.040)
|
|
|
|
|
StateArizona
|
0.353***
|
|
|
(0.017)
|
|
|
|
|
StateArkansas
|
-0.414***
|
|
|
(0.020)
|
|
|
|
|
StateCalifornia
|
0.125***
|
|
|
(0.021)
|
|
|
|
|
StateColorado
|
0.371***
|
|
|
(0.023)
|
|
|
|
|
StateConnecticut
|
0.149***
|
|
|
(0.018)
|
|
|
|
|
StateDelaware
|
0.345***
|
|
|
(0.023)
|
|
|
|
|
StateFlorida
|
0.035*
|
|
|
(0.021)
|
|
|
|
|
StateGeorgia
|
0.211***
|
|
|
(0.020)
|
|
|
|
|
StateHawaii
|
-0.299***
|
|
|
(0.027)
|
|
|
|
|
StateIdaho
|
-0.047*
|
|
|
(0.025)
|
|
|
|
|
StateIllinois
|
0.128***
|
|
|
(0.015)
|
|
|
|
|
StateIndiana
|
0.179***
|
|
|
(0.015)
|
|
|
|
|
StateIowa
|
-0.803***
|
|
|
(0.023)
|
|
|
|
|
StateKansas
|
-0.293***
|
|
|
(0.021)
|
|
|
|
|
StateKentucky
|
0.691***
|
|
|
(0.014)
|
|
|
|
|
StateLouisiana
|
0.406***
|
|
|
(0.017)
|
|
|
|
|
StateMaine
|
-0.115***
|
|
|
(0.031)
|
|
|
|
|
StateMaryland
|
-0.950***
|
|
|
(0.022)
|
|
|
|
|
StateMassachusetts
|
0.267***
|
|
|
(0.014)
|
|
|
|
|
StateMichigan
|
-0.028*
|
|
|
(0.014)
|
|
|
|
|
StateMinnesota
|
-0.540***
|
|
|
(0.019)
|
|
|
|
|
StateMississippi
|
-0.019
|
|
|
(0.019)
|
|
|
|
|
StateMissouri
|
0.158***
|
|
|
(0.015)
|
|
|
|
|
StateMontana
|
-0.524***
|
|
|
(0.031)
|
|
|
|
|
StateNebraska
|
-0.852***
|
|
|
(0.030)
|
|
|
|
|
StateNevada
|
0.622***
|
|
|
(0.020)
|
|
|
|
|
StateNew Hampshire
|
0.159***
|
|
|
(0.024)
|
|
|
|
|
StateNew Jersey
|
0.159***
|
|
|
(0.018)
|
|
|
|
|
StateNew Mexico
|
0.635***
|
|
|
(0.017)
|
|
|
|
|
StateNew York
|
-0.161***
|
|
|
(0.014)
|
|
|
|
|
StateNorth Carolina
|
0.264***
|
|
|
(0.013)
|
|
|
|
|
StateNorth Dakota
|
-1.017***
|
|
|
(0.050)
|
|
|
|
|
StateOhio
|
0.428***
|
|
|
(0.013)
|
|
|
|
|
StateOklahoma
|
0.425***
|
|
|
(0.017)
|
|
|
|
|
StateOregon
|
-0.178***
|
|
|
(0.018)
|
|
|
|
|
StatePennsylvania
|
0.322***
|
|
|
(0.015)
|
|
|
|
|
StateRhode Island
|
0.232***
|
|
|
(0.022)
|
|
|
|
|
StateSouth Carolina
|
0.208***
|
|
|
(0.015)
|
|
|
|
|
StateSouth Dakota
|
-1.028***
|
|
|
(0.043)
|
|
|
|
|
StateTennessee
|
0.484***
|
|
|
(0.014)
|
|
|
|
|
StateTexas
|
0.146***
|
|
|
(0.024)
|
|
|
|
|
StateUtah
|
0.574***
|
|
|
(0.048)
|
|
|
|
|
StateVermont
|
-0.316***
|
|
|
(0.033)
|
|
|
|
|
StateVirginia
|
0.017
|
|
|
(0.016)
|
|
|
|
|
StateWashington
|
0.233***
|
|
|
(0.018)
|
|
|
|
|
StateWest Virginia
|
0.687***
|
|
|
(0.021)
|
|
|
|
|
StateWisconsin
|
-0.052***
|
|
|
(0.015)
|
|
|
|
|
StateWyoming
|
0.032
|
|
|
(0.034)
|
|
|
|
|
Naloxone_Pharmacy_Yes_Redefined
|
-0.011
|
|
|
(0.008)
|
|
|
|
|
Naloxone_Pharmacy_No_Redefined
|
0.017**
|
|
|
(0.007)
|
|
|
|
|
Medical_Marijuana_Redefined
|
0.063***
|
|
|
(0.006)
|
|
|
|
|
Recreational_Marijuana_Redefined
|
-0.053***
|
|
|
(0.009)
|
|
|
|
|
GSL_Redefined
|
0.013**
|
|
|
(0.006)
|
|
|
|
|
PDMP_Redefined
|
-0.045***
|
|
|
(0.006)
|
|
|
|
|
Medicaid_Expansion_Redefined
|
0.088***
|
|
|
(0.006)
|
|
|
|
|
Intervention_Redefined
|
0.062***
|
|
|
(0.006)
|
|
|
|
|
num_states_w_intervention
|
0.005***
|
|
|
(0.002)
|
|
|
|
|
mean_unemployment
|
-0.636***
|
|
|
(0.182)
|
|
|
|
|
pop_prop_25_34
|
0.698
|
|
|
(0.594)
|
|
|
|
|
pop_prop_35_44
|
-3.139***
|
|
|
(0.588)
|
|
|
|
|
pop_prop_45_64
|
3.153***
|
|
|
(0.694)
|
|
|
|
|
pop_prop_65_plus
|
5.840***
|
|
|
(0.634)
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Midwest.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)Northeast.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)South.9
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.1
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.2
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.3
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.4
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.5
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.6
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.7
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.8
|
|
|
|
|
|
|
|
|
s(Time_Period_ID):as.factor(Region)West.9
|
|
|
|
|
|
|
|
|
Constant
|
-11.637***
|
|
|
(0.500)
|
|
|
|
|
|
|
Observations
|
2,000
|
|
Adjusted R2
|
0.913
|
|
Log Likelihood
|
-16,521.120
|
|
UBRE
|
8.610
|
|
|
|
Note:
|
p<0.1; p<0.05; p<0.01
|
Sandwich Estimator
#here, we estimate the variance-covariance matrix through the sandwich estimator
#we obtain the full covariance matrix with smoothed terms
full_df_w_basis_functions_sen_sensitivity_anlys_age_unemp <- data.frame(predict(sensitivity_anlys_age_unemp_model, type = "lpmatrix"))
#estimate the 95% CI and SD
sensitivity_anlys_age_unemp_subset_coefficient_values <- coef(sensitivity_anlys_age_unemp_model)
#type = "response" to get the estimated probabilities
sensitivity_anlys_age_unemp_subset_pred_prob <- predict(sensitivity_anlys_age_unemp_model,
newdata = sensitivity_anlys_age_gp_unemp, type = "response")
sensitivity_anlys_age_unemp_subset_sd_and_ci <- compute_sd_and_CI(full_df_w_basis_functions_sen_sensitivity_anlys_age_unemp,
sensitivity_anlys_age_gp_unemp$population,
sensitivity_anlys_age_gp_unemp$imputed_deaths,
sensitivity_anlys_age_unemp_subset_pred_prob,
sensitivity_anlys_age_unemp_subset_coefficient_values)
round(sensitivity_anlys_age_unemp_subset_sd_and_ci, 4)
## lb_coef coef_values ub_coef
## (Intercept) -15.0520 -11.6371 -8.2223
## StateAlaska 0.4782 0.6705 0.8628
## StateArizona 0.2531 0.3526 0.4520
## StateArkansas -0.5107 -0.4135 -0.3163
## StateCalifornia 0.0042 0.1245 0.2448
## StateColorado 0.2508 0.3711 0.4913
## StateConnecticut 0.0405 0.1487 0.2569
## StateDelaware 0.2237 0.3450 0.4664
## StateFlorida -0.1018 0.0350 0.1718
## StateGeorgia 0.0938 0.2112 0.3286
## StateHawaii -0.4147 -0.2986 -0.1825
## StateIdaho -0.1491 -0.0467 0.0557
## StateIllinois 0.0311 0.1275 0.2240
## StateIndiana 0.1007 0.1791 0.2575
## StateIowa -0.8980 -0.8033 -0.7085
## StateKansas -0.3947 -0.2930 -0.1913
## StateKentucky 0.6166 0.6906 0.7647
## StateLouisiana 0.3169 0.4062 0.4956
## StateMaine -0.2887 -0.1155 0.0578
## StateMaryland -1.1733 -0.9500 -0.7268
## StateMassachusetts 0.1615 0.2666 0.3717
## StateMichigan -0.1057 -0.0278 0.0502
## StateMinnesota -0.6290 -0.5402 -0.4513
## StateMississippi -0.1130 -0.0191 0.0748
## StateMissouri 0.0807 0.1575 0.2343
## StateMontana -0.6229 -0.5236 -0.4242
## StateNebraska -0.9588 -0.8522 -0.7456
## StateNevada 0.5059 0.6219 0.7379
## StateNew Hampshire 0.0254 0.1586 0.2917
## StateNew Jersey 0.0278 0.1586 0.2894
## StateNew Mexico 0.5425 0.6353 0.7281
## StateNew York -0.2420 -0.1607 -0.0793
## StateNorth Carolina 0.1947 0.2643 0.3339
## StateNorth Dakota -1.2097 -1.0172 -0.8247
## StateOhio 0.3388 0.4276 0.5164
## StateOklahoma 0.3225 0.4255 0.5285
## StateOregon -0.2680 -0.1775 -0.0870
## StatePennsylvania 0.2343 0.3224 0.4105
## StateRhode Island 0.1095 0.2323 0.3551
## StateSouth Carolina 0.1406 0.2081 0.2756
## StateSouth Dakota -1.1405 -1.0277 -0.9148
## StateTennessee 0.4132 0.4844 0.5557
## StateTexas 0.0113 0.1461 0.2809
## StateUtah 0.2596 0.5740 0.8885
## StateVermont -0.4426 -0.3155 -0.1884
## StateVirginia -0.0758 0.0169 0.1096
## StateWashington 0.1309 0.2329 0.3348
## StateWest Virginia 0.5572 0.6869 0.8166
## StateWisconsin -0.1215 -0.0519 0.0178
## StateWyoming -0.0922 0.0324 0.1570
## Naloxone_Pharmacy_Yes_Redefined -0.0614 -0.0113 0.0387
## Naloxone_Pharmacy_No_Redefined -0.0214 0.0168 0.0551
## Medical_Marijuana_Redefined 0.0192 0.0635 0.1077
## Recreational_Marijuana_Redefined -0.1028 -0.0531 -0.0033
## GSL_Redefined -0.0296 0.0130 0.0556
## PDMP_Redefined -0.0830 -0.0449 -0.0067
## Medicaid_Expansion_Redefined 0.0551 0.0875 0.1199
## Intervention_Redefined 0.0221 0.0616 0.1012
## num_states_w_intervention -0.0055 0.0055 0.0164
## mean_unemployment -1.7469 -0.6363 0.4743
## pop_prop_25_34 -3.1826 0.6978 4.5783
## pop_prop_35_44 -7.8039 -3.1395 1.5249
## pop_prop_45_64 -1.3753 3.1530 7.6812
## pop_prop_65_plus 1.6065 5.8404 10.0742
## s(Time_Period_ID):as.factor(Region)Midwest.1 -0.3975 -0.1643 0.0689
## s(Time_Period_ID):as.factor(Region)Midwest.2 -0.1798 -0.0410 0.0977
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.0808 0.2053 0.3298
## s(Time_Period_ID):as.factor(Region)Midwest.4 -0.0122 0.1343 0.2808
## s(Time_Period_ID):as.factor(Region)Midwest.5 -0.0162 0.1844 0.3850
## s(Time_Period_ID):as.factor(Region)Midwest.6 -0.0583 0.1924 0.4430
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.0251 0.3120 0.5989
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.2275 0.5659 0.9043
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.0723 0.3839 0.6956
## s(Time_Period_ID):as.factor(Region)Northeast.1 -0.3801 -0.1399 0.1003
## s(Time_Period_ID):as.factor(Region)Northeast.2 -0.2925 -0.1395 0.0136
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.0666 0.1965 0.3265
## s(Time_Period_ID):as.factor(Region)Northeast.4 -0.2233 -0.0722 0.0789
## s(Time_Period_ID):as.factor(Region)Northeast.5 -0.2228 -0.0241 0.1746
## s(Time_Period_ID):as.factor(Region)Northeast.6 -0.2121 0.0428 0.2978
## s(Time_Period_ID):as.factor(Region)Northeast.7 -0.0384 0.2493 0.5369
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.2204 0.5748 0.9292
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.0805 0.3913 0.7022
## s(Time_Period_ID):as.factor(Region)South.1 -0.1416 0.0308 0.2032
## s(Time_Period_ID):as.factor(Region)South.2 0.0196 0.1268 0.2339
## s(Time_Period_ID):as.factor(Region)South.3 0.1911 0.2650 0.3389
## s(Time_Period_ID):as.factor(Region)South.4 0.1149 0.2156 0.3164
## s(Time_Period_ID):as.factor(Region)South.5 0.0292 0.2094 0.3897
## s(Time_Period_ID):as.factor(Region)South.6 -0.1846 0.0493 0.2832
## s(Time_Period_ID):as.factor(Region)South.7 -0.0997 0.1707 0.4411
## s(Time_Period_ID):as.factor(Region)South.8 0.0136 0.3515 0.6894
## s(Time_Period_ID):as.factor(Region)South.9 -0.0972 0.2030 0.5032
## s(Time_Period_ID):as.factor(Region)West.1 -0.1966 0.0411 0.2788
## s(Time_Period_ID):as.factor(Region)West.2 0.0233 0.1566 0.2899
## s(Time_Period_ID):as.factor(Region)West.3 0.0504 0.1686 0.2868
## s(Time_Period_ID):as.factor(Region)West.4 0.0514 0.1755 0.2997
## s(Time_Period_ID):as.factor(Region)West.5 -0.1286 0.0610 0.2505
## s(Time_Period_ID):as.factor(Region)West.6 -0.2877 -0.0424 0.2030
## s(Time_Period_ID):as.factor(Region)West.7 -0.3536 -0.0693 0.2150
## s(Time_Period_ID):as.factor(Region)West.8 -0.3893 -0.0338 0.3216
## s(Time_Period_ID):as.factor(Region)West.9 -0.1976 0.1086 0.4149
## exp_lb exp_coef exp_ub
## (Intercept) 0.0000 0.0000 0.0003
## StateAlaska 1.6132 1.9552 2.3698
## StateArizona 1.2881 1.4227 1.5714
## StateArkansas 0.6000 0.6613 0.7288
## StateCalifornia 1.0042 1.1326 1.2774
## StateColorado 1.2851 1.4493 1.6344
## StateConnecticut 1.0413 1.1603 1.2929
## StateDelaware 1.2507 1.4120 1.5942
## StateFlorida 0.9032 1.0356 1.1874
## StateGeorgia 1.0984 1.2352 1.3891
## StateHawaii 0.6605 0.7419 0.8332
## StateIdaho 0.8615 0.9544 1.0573
## StateIllinois 1.0315 1.1360 1.2511
## StateIndiana 1.1060 1.1962 1.2937
## StateIowa 0.4074 0.4479 0.4924
## StateKansas 0.6739 0.7460 0.8259
## StateKentucky 1.8526 1.9950 2.1484
## StateLouisiana 1.3728 1.5012 1.6415
## StateMaine 0.7492 0.8909 1.0595
## StateMaryland 0.3093 0.3867 0.4835
## StateMassachusetts 1.1753 1.3055 1.4501
## StateMichigan 0.8997 0.9726 1.0515
## StateMinnesota 0.5331 0.5827 0.6368
## StateMississippi 0.8932 0.9811 1.0777
## StateMissouri 1.0841 1.1706 1.2640
## StateMontana 0.5364 0.5924 0.6543
## StateNebraska 0.3834 0.4265 0.4745
## StateNevada 1.6584 1.8624 2.0914
## StateNew Hampshire 1.0257 1.1719 1.3388
## StateNew Jersey 1.0282 1.1719 1.3357
## StateNew Mexico 1.7203 1.8875 2.0711
## StateNew York 0.7850 0.8516 0.9237
## StateNorth Carolina 1.2149 1.3025 1.3964
## StateNorth Dakota 0.2983 0.3616 0.4383
## StateOhio 1.4032 1.5336 1.6760
## StateOklahoma 1.3806 1.5303 1.6963
## StateOregon 0.7649 0.8373 0.9166
## StatePennsylvania 1.2640 1.3804 1.5075
## StateRhode Island 1.1158 1.2615 1.4263
## StateSouth Carolina 1.1510 1.2313 1.3173
## StateSouth Dakota 0.3197 0.3578 0.4006
## StateTennessee 1.5116 1.6232 1.7431
## StateTexas 1.0114 1.1573 1.3243
## StateUtah 1.2964 1.7754 2.4316
## StateVermont 0.6423 0.7294 0.8283
## StateVirginia 0.9270 1.0171 1.1159
## StateWashington 1.1399 1.2622 1.3977
## StateWest Virginia 1.7457 1.9875 2.2629
## StateWisconsin 0.8856 0.9495 1.0179
## StateWyoming 0.9119 1.0329 1.1700
## Naloxone_Pharmacy_Yes_Redefined 0.9405 0.9887 1.0395
## Naloxone_Pharmacy_No_Redefined 0.9788 1.0170 1.0566
## Medical_Marijuana_Redefined 1.0194 1.0655 1.1138
## Recreational_Marijuana_Redefined 0.9023 0.9483 0.9967
## GSL_Redefined 0.9708 1.0131 1.0572
## PDMP_Redefined 0.9203 0.9561 0.9933
## Medicaid_Expansion_Redefined 1.0566 1.0915 1.1274
## Intervention_Redefined 1.0223 1.0636 1.1065
## num_states_w_intervention 0.9946 1.0055 1.0166
## mean_unemployment 0.1743 0.5293 1.6069
## pop_prop_25_34 0.0415 2.0094 97.3464
## pop_prop_35_44 0.0004 0.0433 4.5948
## pop_prop_45_64 0.2528 23.4059 2167.2857
## pop_prop_65_plus 4.9854 343.9031 23723.3364
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.6720 0.8485 1.0713
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.8354 0.9598 1.1026
## s(Time_Period_ID):as.factor(Region)Midwest.3 1.0842 1.2279 1.3907
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.9879 1.1437 1.3242
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.9839 1.2025 1.4696
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.9434 1.2121 1.5574
## s(Time_Period_ID):as.factor(Region)Midwest.7 1.0254 1.3662 1.8202
## s(Time_Period_ID):as.factor(Region)Midwest.8 1.2555 1.7610 2.4702
## s(Time_Period_ID):as.factor(Region)Midwest.9 1.0750 1.4680 2.0049
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.6838 0.8694 1.1055
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.7464 0.8698 1.0137
## s(Time_Period_ID):as.factor(Region)Northeast.3 1.0688 1.2172 1.3861
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.7999 0.9303 1.0821
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.8003 0.9762 1.1907
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.8089 1.0437 1.3468
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.9623 1.2831 1.7108
## s(Time_Period_ID):as.factor(Region)Northeast.8 1.2465 1.7767 2.5324
## s(Time_Period_ID):as.factor(Region)Northeast.9 1.0838 1.4789 2.0182
## s(Time_Period_ID):as.factor(Region)South.1 0.8680 1.0313 1.2254
## s(Time_Period_ID):as.factor(Region)South.2 1.0198 1.1351 1.2636
## s(Time_Period_ID):as.factor(Region)South.3 1.2106 1.3035 1.4034
## s(Time_Period_ID):as.factor(Region)South.4 1.1218 1.2407 1.3721
## s(Time_Period_ID):as.factor(Region)South.5 1.0296 1.2330 1.4765
## s(Time_Period_ID):as.factor(Region)South.6 0.8315 1.0505 1.3273
## s(Time_Period_ID):as.factor(Region)South.7 0.9051 1.1862 1.5544
## s(Time_Period_ID):as.factor(Region)South.8 1.0137 1.4212 1.9925
## s(Time_Period_ID):as.factor(Region)South.9 0.9074 1.2251 1.6540
## s(Time_Period_ID):as.factor(Region)West.1 0.8215 1.0420 1.3216
## s(Time_Period_ID):as.factor(Region)West.2 1.0236 1.1696 1.3363
## s(Time_Period_ID):as.factor(Region)West.3 1.0517 1.1836 1.3322
## s(Time_Period_ID):as.factor(Region)West.4 1.0527 1.1919 1.3494
## s(Time_Period_ID):as.factor(Region)West.5 0.8793 1.0629 1.2847
## s(Time_Period_ID):as.factor(Region)West.6 0.7500 0.9585 1.2251
## s(Time_Period_ID):as.factor(Region)West.7 0.7021 0.9331 1.2399
## s(Time_Period_ID):as.factor(Region)West.8 0.6775 0.9667 1.3794
## s(Time_Period_ID):as.factor(Region)West.9 0.8207 1.1148 1.5142
## sd_coef
## (Intercept) 1.7423
## StateAlaska 0.0981
## StateArizona 0.0507
## StateArkansas 0.0496
## StateCalifornia 0.0614
## StateColorado 0.0613
## StateConnecticut 0.0552
## StateDelaware 0.0619
## StateFlorida 0.0698
## StateGeorgia 0.0599
## StateHawaii 0.0592
## StateIdaho 0.0522
## StateIllinois 0.0492
## StateIndiana 0.0400
## StateIowa 0.0483
## StateKansas 0.0519
## StateKentucky 0.0378
## StateLouisiana 0.0456
## StateMaine 0.0884
## StateMaryland 0.1139
## StateMassachusetts 0.0536
## StateMichigan 0.0398
## StateMinnesota 0.0453
## StateMississippi 0.0479
## StateMissouri 0.0392
## StateMontana 0.0507
## StateNebraska 0.0544
## StateNevada 0.0592
## StateNew Hampshire 0.0679
## StateNew Jersey 0.0668
## StateNew Mexico 0.0473
## StateNew York 0.0415
## StateNorth Carolina 0.0355
## StateNorth Dakota 0.0982
## StateOhio 0.0453
## StateOklahoma 0.0525
## StateOregon 0.0462
## StatePennsylvania 0.0449
## StateRhode Island 0.0626
## StateSouth Carolina 0.0344
## StateSouth Dakota 0.0576
## StateTennessee 0.0364
## StateTexas 0.0688
## StateUtah 0.1605
## StateVermont 0.0648
## StateVirginia 0.0473
## StateWashington 0.0520
## StateWest Virginia 0.0662
## StateWisconsin 0.0355
## StateWyoming 0.0636
## Naloxone_Pharmacy_Yes_Redefined 0.0255
## Naloxone_Pharmacy_No_Redefined 0.0195
## Medical_Marijuana_Redefined 0.0226
## Recreational_Marijuana_Redefined 0.0254
## GSL_Redefined 0.0217
## PDMP_Redefined 0.0195
## Medicaid_Expansion_Redefined 0.0165
## Intervention_Redefined 0.0202
## num_states_w_intervention 0.0056
## mean_unemployment 0.5666
## pop_prop_25_34 1.9798
## pop_prop_35_44 2.3798
## pop_prop_45_64 2.3103
## pop_prop_65_plus 2.1601
## s(Time_Period_ID):as.factor(Region)Midwest.1 0.1190
## s(Time_Period_ID):as.factor(Region)Midwest.2 0.0708
## s(Time_Period_ID):as.factor(Region)Midwest.3 0.0635
## s(Time_Period_ID):as.factor(Region)Midwest.4 0.0747
## s(Time_Period_ID):as.factor(Region)Midwest.5 0.1023
## s(Time_Period_ID):as.factor(Region)Midwest.6 0.1279
## s(Time_Period_ID):as.factor(Region)Midwest.7 0.1464
## s(Time_Period_ID):as.factor(Region)Midwest.8 0.1726
## s(Time_Period_ID):as.factor(Region)Midwest.9 0.1590
## s(Time_Period_ID):as.factor(Region)Northeast.1 0.1225
## s(Time_Period_ID):as.factor(Region)Northeast.2 0.0781
## s(Time_Period_ID):as.factor(Region)Northeast.3 0.0663
## s(Time_Period_ID):as.factor(Region)Northeast.4 0.0771
## s(Time_Period_ID):as.factor(Region)Northeast.5 0.1014
## s(Time_Period_ID):as.factor(Region)Northeast.6 0.1301
## s(Time_Period_ID):as.factor(Region)Northeast.7 0.1468
## s(Time_Period_ID):as.factor(Region)Northeast.8 0.1808
## s(Time_Period_ID):as.factor(Region)Northeast.9 0.1586
## s(Time_Period_ID):as.factor(Region)South.1 0.0880
## s(Time_Period_ID):as.factor(Region)South.2 0.0547
## s(Time_Period_ID):as.factor(Region)South.3 0.0377
## s(Time_Period_ID):as.factor(Region)South.4 0.0514
## s(Time_Period_ID):as.factor(Region)South.5 0.0920
## s(Time_Period_ID):as.factor(Region)South.6 0.1193
## s(Time_Period_ID):as.factor(Region)South.7 0.1380
## s(Time_Period_ID):as.factor(Region)South.8 0.1724
## s(Time_Period_ID):as.factor(Region)South.9 0.1531
## s(Time_Period_ID):as.factor(Region)West.1 0.1213
## s(Time_Period_ID):as.factor(Region)West.2 0.0680
## s(Time_Period_ID):as.factor(Region)West.3 0.0603
## s(Time_Period_ID):as.factor(Region)West.4 0.0633
## s(Time_Period_ID):as.factor(Region)West.5 0.0967
## s(Time_Period_ID):as.factor(Region)West.6 0.1252
## s(Time_Period_ID):as.factor(Region)West.7 0.1451
## s(Time_Period_ID):as.factor(Region)West.8 0.1814
## s(Time_Period_ID):as.factor(Region)West.9 0.1563
#residual plot
binnedplot(fitted(sensitivity_anlys_age_unemp_model), resid(sensitivity_anlys_age_unemp_model))
